Thursday, 28th August 2008
The most common compression algorithm used on UNIX systems is gzip (.gz).
Gzip and Gunzip compress and uncompress files, respectively.
The syntax is as follows:
# to compress
$ gzip [filename]
# to decompress
$ gunzip [filename]
Some extra points of note:
# gives you some stats on the compressed file
$ gzip -l compressed_file.gz
compressed uncompressed ratio uncompressed_name
6864073 7126269 3.7% compressed_file.txt
# recursively grabs everything in directory1
gzip -r directory1/
Gzip is the most common compression algorithm, but lately it has been superseded by bzip2.