Skip to content

How to Decompress .tar.bz2 Files in Linux

There are many reasons why computer users compress their files. The most common reason is to conserve storage. In Linux, there is quite a selection of compression tools available. There’s .tar, .gzip, .bzip2, .xz,  .tar.bz2, and a lot more. The decompression is straight forward. For example, using tar, one can decompress an archive as such:
$[root@samgalope] # tar xvf tar.tar

However, there are times when tar is combined with bzip2. This is to ensure that the file structures as well as directories are preserved (archived) and the total file size is reduced (compressed). To extract such files properly, use any of the commands below.

Use any one of the following syntax:

#Variations of the same thing
bzip2 -dc filename.tar.bz2 | tar xvf -
bzip2 -dc filename.tbz2 | tar xvf -
bzip2 -dc filename.tbz | tar xvf -

OR use gnu/tar command syntax:

#Variations of the same thing
tar -jxvf filename.tar.bz2
tar -jxvf filename.tbz2
tar -jxvf filename.tbz

bzip2 command options:

-d : Force decompression.
-c : Decompress to standard output so-that tar command can take input.
tar command options:
-j : Call bzip2 to decompress file.
-x : Extract file.
-v : Verbose mode
-f : Archive name.

Comments are closed.