Compress and Uncompress using TAR

I often fall into situation where I have forgotten how to uncompress a tar file, specially during a new application setting up. Since this method of compression is outdate (but still widely used) and I have made my self comfortable in using “zip”. Commands for compressing and uncompressing a tar file is just as simple as zip.

 

Below is an example of compressing a folder “mango” into “mango.tar.gz”. Atributes after the command, “c” compress, “z” zip, “f” file, “v” verbose. If you want “bzip” file after compression rather than “gz”, use “j” instead of “z”.

tar czvf mango.tar.gz mango/

For uncompressing a “tar” file, use “x” extract atribute as shown below,

tar -xzvf Mango.tar.gz