Breadcrumbs 
Learning >> Documentation >> Compression >> gzip
 
Recent News
We're No 1!
We've reached the top! (Of Google!)
[ more ]
Firefox 3 Download Day
Firefox 3 has been officially released and is looking to set a world record for the most downloaded piece of software in 24hrs.
[ more ]
SSL Renewed
SSL cert has been renewed by the admin team.
[ more ]
gzip
gzip

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 examples:

# creates archive.tar.gz, which is compressed
$ gzip archive.tar

# uncompresses archive.tar.gz, recreating archive.tar
$ gunzip archive.tar.gz

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.