Tar or tar ball is built into every unix system. It can create and manipulate archive files. It can even extract files from a zip, ar, cpio, shar, pax, and other archives.

To tar a file you simply run the following command :


tar -cvf output.tar /dirname

In the above statement, you will be creating a tar of the directory /dirname with the name “output.tar” with the modifier flags -cvf.

The modifier flags for tar ball are as follows :
-c : Create a tar ball.
-v : Verbose output (show the progress).
-f : Output tar ball archive file name.
-x : Extract all files from the archived tar.
-t : Display the contents (file list) of an archive.

Now to extract a tar ball is just as easy :


tar -xvf output.tar

The above command will untar ball output.tar in the current directory that you are in.

Tagged: