Unlike archiving programs for MS-DOS, tar does not automatically compress files as it archives them. Therefore, if you are archiving two 1-megabyte files, the resulting tar file will be two megabytes in size. The gzip command may be used to compress a file (the file to compress need not be a tar file). The command
#gzip -9 backup.tarwill compress backup.tar and leave you with backup.tar.gz, the compressed version of the file. The -9 switch tells gzip to use the highest compression factor.
The gunzip command may be used to uncompress a gzipped file. Equivalently, you may use ``gzip -d''.
gzip is a relatively new tool in the UNIX community. For many years, the compress command was used instead. However, because of several factors[Footnote], compress is being phased out.
compressed files end in the extension .Z. For example, backup.tar.Z is the compressed version of backup.tar, while backup.tar.gz is the gzipped version[Footnote]. The uncompress command is used to expand a compressed file; gunzip knows how to handle compressed files as well.