Find it
Custom Search

Saturday, October 22, 2005

Uncompressing Files with TAR Command

The tar command can be used for file compression and decompression in Linux. But for this post we will tackle only decompressing files.

Tar command can be used to decompress tar (.tar), gunzip (.gz), and binary zip (.bz2) files.

In order to use this command, in the Linux console/terminal you must type
the command, followed by the options, and the path of the file to decompress.

$ tar xzvf ktoonbin-0.7.3.tar.gz


tar - is the command
xzvf - are the options
ktoonbin-0.7.3.tar.gz - is the file

to extract a .bz2 file we type:
$ tar xjf gyach-enhanced_pyvoice-binary-1.0.7-i586.tar.bz2

Let us examine further the options following the tar command:

Options tell the tar command what it is supposed to do and what input to take.
Each option is comprised of one character that bears a meaning and can be combined with other options.

x - in the first and second example tells the tar command to extract from a compressed file.

z- will tell it to extract from a gunzipped file.

v- simply means to list the files it is currently extracting

f- means to take a file as input

In the second example you will notice the we have "j" instead of "z" for our option.

j option tells tar command to extract from a .bz2 or binary zipped file instead of a gunzipped file.

Once the tar command is finished extracting or decompressing files, you will see its output on the current directory you are in.

Just do an ls command to view the extracted files.

To see what other options are available for the tar command, please type:
$ man tar

No comments: