gzip Basics

Improvements? Suggestions? email dna@hola.org

.Z files (deletes processed file after compressing/uncompressing)

  1. to compress:
    $ compress file_name
  2. to uncompress:
    $ uncompress file_name

.gz files (deletes processed file after zipping/unzipping)

  1. to zip:
    $ gzip file_name
  2. to unzip:
    $ gunzip file_name
  3. to open a gz file without deleting the zipped file after unzipping, gunzip (or bunzip2 for bz2 files) with -c (console output) and redirection in order to keep the original file:
    $ gunzip -c file_name.gz > file_name

.tar files

  1. to create:
    $ tar cvf file_name.tar files_to_process
  2. to extract:
    $ tar xvf file_name.tar
  3. to view content:
    $ tar tf file_name.tar

.tgz and .tar.gz files

$ tar xzvf file_name.tgz
does the same as: $ gunzip -c file_name.tar.gz | tar xv

.tar.bz2 files

$ tar xIvf file_name.tar.bz2