This post is about the linux commands "tar" and "gzip" and will show you how to use these convenient tools in terminal on Linux/OS X.

Gzip and Tarballs

Gzip is a compression tool much like Zip or RAR. A tarball is a collection of files bundled into one .tar file. A tarball is not compressed, only glued together for ease of handling.

Typically you would use the Gzip to shrink the size of the tarball, and conveniently enough the tar command has built-in gzip support.

Here are some useful tar/gzip commands:

To create a tarball:

tar -cvvf filename.tar directoryname

To create a Gzip'ed tarball:

tar -zcvf filename.tar.gz directoryname

To gzip a single file:

gzip filename.txt

To extract a tarball:

tar -xvvf filename.tar

To decompress a Gzip'ed tarball:

tar -zxvf filename.tar.gz

To decompress (Gunzip) a gzip'ed file:

gunzip filename.gz

That should get you started gzip'ing tarballs. Now, get on with it :-)