Compression and Extraction in Linux


Compression can be done using three methods: zip, jzip, bzip2. zip is rarely used in Linux, used mainly in Windows. jzip and bzip2 are exclusively used in Linux. Both are more efficient than zip. Out of jzip and bzip2, bzip2 is efficient. But for small files both have the same efficiency. bzip2 show its difference when file size is more than 2mb. Any number of files and sub-directories can be archived and compressed into a single .tar.gz or .taz file.

To archive a file:

tar cvf a.tar abcd

where c in cvf indicates the creation of file a.tar. abcd is the file to be archived.

To compress the archived file:

jzip a.tar

a file named a.tar.gz or a.taz will be created in the current directory.


In the extraction process we first unzip a.taz or to get the archived file.

gunzip a.tar.gz

Now we get a file named a.tar, to make it a normal file:

tar xvf a.tar

Now we get the file abcd. x in xvf indicates the extraction process.

Archiving and Compression Together

tar cvfz a.tar.gz abcd

Extraction in Single Step

tar xvfz a.tar.gz


About Odol Shinu

I've completed my B Tech in Information Technology in 2010 from Government Engineering College Sreekrishnapuram Palakkad under Calicut University.

Posted on August 30, 2010, in GNU/Linux. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: