Using tar is probably one of the most used tools on a linux system. This function is exactly like a zip function. Basically this will allow you to compress and or extract files / directories.

To compress a directory you would type;

tar -cvzf directory name.

Basically you told tar to do create the file, verbose (show the process), compress with GZIP and archive the name; so c = create, v = verbose, z = compress with GZIP, f = archive name. This created a file or commonly referred to as a tarball. To do a file  you would do the same thing, though its commonly used for single files.

To extract the tarball, you simply need to do the following;

tar -xzvf file.tar.gz

You are now telling tar to decompress the file and restore the directory/file.

Tags: , , ,
Leave a Reply