next up previous contents index
Next: 4.5.3 Putting them together Up: 4.5 Archiving and Compressing Previous: 4.5.1 Using tar

4.5.2 gzip and compress

    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.tar

will 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 factorsgif, 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 versiongif. The uncompress command is used to expand a compressed file; gunzip knows how to handle compressed files as well.



next up previous contents index
Next: 4.5.3 Putting them together Up: 4.5 Archiving and Compressing Previous: 4.5.1 Using tar



Matt Welsh
mdw@sunsite.unc.edu