Compressing Files in Linux – TAR and BZIP

We all run out of space some time or the other and frankly it doesnt hurt to compress older unused files. Here’s a simple guide on how to compress files in Linux using tar and bzip2.

Step 1:

tar is available on most Linux distros by default. So you need not download it.

bzip2 can be downloaded from http://www.bzip.org/downloads.html

Step 2 :

Compress and decompress single files using the following commands –
To compress a single file,

bzip2 :filename:

To decompress a single file,

bunzip2 :filename:

Step 3 :

To compress and decompress multiple files we need tar.It is done by using the following commands –
To compress multiple files,

tar cvjf :filename.tar.bz: :file1: :file2:

where,
c – compress,
v – verbose,
j – compress with bzip before making tarball

To decompress a single file,

tar xvjf :filename.tar.bz: :file1: :file2:

where,
x – extract,
v – verbose,
j – compress with bzip before making tarball

Advertisements

About synapse
Programming, motorcycles and photography. Want to do more, but only have time for so much!

2 Responses to Compressing Files in Linux – TAR and BZIP

  1. Pingback: kumho ecsta asx tire

  2. Pingback: costume party supply

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: