Unix Help
Compressing Files :compress, uncompress, zcat

If you have files that you would like to keep, and you know you will not be using those files often, you might want to consider compressing them to save space. There are several compression schemes available, but the most popular is the compress command:


        compress <filename>
will encode your file and possibly save a great deal of space. The file <filename> will be replaced with filename.Z. You can display this file to the screen using the zcat command:

        zcat <filename> | more
will display the file using the more command to stop at each screenfull.

When you wish to expand the file for editing, the command


        uncompress <filename>
will de-encode the file and write it out as <filename> once more. For example, our friend joe-user has a file called hold.tex that is using 13,735 bytes. This is how the compression would take place: (the -v is the verbose option and prints the informative message following the command.)

        UNIX> compress -v hold.tex
        hold.tex: Compression: 67.33% -- replaced with hold.tex.Z
        UNIX> ls -l hold.tex.Z
        -rw-r--r--  1 joe-user     4487 July 11 11:30 hold.tex.Z
hold.tex.Z (the compressed file) now uses only 4,487 bytes. To restore the file to its fully expanded form:

        UNIX> uncompress hold.tex
        UNIX> ls -l hold.tex
        -rw-r--r--  1 joe-user     13735 July 11 11:30 hold.tex

As always, there is more information found in the manual page (man compress).