gzip is often associated with a utility named tar. tar is a survivor of antediluvian times, when computerists stored their data on tapes. Nowadays, floppy disks, CD-ROM and DVD have replaced tapes, but tar is still being used to create archives. All the files in a directory can be appended in a single file for instance. This file can then be easily compressed with gzip.
This is the reason why much free software is available as tar archives, compressed with gzip. So, their extensions are .tar.gz (or also .tgz to shorten).
To decompress this archive, gzip and then tar can be used. But the GNU version of tar (gtar) allows us to use gzip “on-the-fly”, and to decompress an archive file without noticing each step (and without the need for the extra disk space). The use of tar follows this format:
tar
The
For instance:
$ tar xvfz guile-1.3.tar.gz
-rw-r--r-- 442/1002 10555 1998-10-20 07:31 guile-1.3/Makefile.in
-rw-rw-rw- 442/1002 6668 1998-10-20 06:59 guile-1.3/README
-rw-rw-rw- 442/1002 2283 1998-02-01 22:05 guile-1.3/AUTHORS
-rw-rw-rw- 442/1002 17989 1997-05-27 00:36 guile-1.3/COPYING
-rw-rw-rw- 442/1002 28545 1998-10-20 07:05 guile-1.3/ChangeLog
-rw-rw-rw- 442/1002 9364 1997-10-25 08:34 guile-1.3/INSTALL
-rw-rw-rw- 442/1002 1223 1998-10-20 06:34 guile-1.3/Makefile.am
-rw-rw-rw- 442/1002 98432 1998-10-20 07:30 guile-1.3/NEWS
-rw-rw-rw- 442/1002 1388 1998-10-20 06:19 guile-1.3/THANKS
-rw-rw-rw- 442/1002 1151 1998-08-16 21:45 guile-1.3/TODO
...
Among the options of tar:
• v makes tar verbose. This means it will display all the files it finds in the archive on the screen. If this option is omitted, the processing will be silent.
• f is a required option.Without it, tar tries to use a tape instead of an archive file (i.e., the /dev/rmt0 device).
• z allows you to process a “gziped” archive (with a .gz extension). If this option is forgotten, tar will producean error. Conversely, this option must not be used with an uncompressed archive.
tar allows you to perform several actions on an archive (extract, read, create, add...). An option defines which action is used:
• x: allows you to extract files from the archive.
• t: lists the contents of the archive.
• c: allows you to create an archive. You may use it to backup your personal files, for instance.
• r: allows you to add files at the end of the archive. It cannot be used on an already compressed archive.