If you’ve ever tried to decompress a file that ends in tar.bz2 using the tar command, you’ll have noticed that it doesn’t work. That’s because the tar command does not understand the binzip codec used in these archives.
Instead, we can use the bzip2 command like so:
bzip2 -d yourfile.tar.bz2
The -d switch stands for “decompress”. Notice that this will extract all files and delete the original .bz2 file by default. Very convenient indeed! If you’d like to keep it, just pass the -k switch (for “keep”), like this:
bzip2 -dk yourfile.tar.z2
Checkout man bzip2 for more details, or pass the –help for as quick overview.