Extract .tar.bz2 File in Linux

Last updated on Dec 28, 2019 in Linux

.tar.bz2 is a compressed tar archive file created with tar utility using -j as an argument (bzip2 compression). Decompressing this type of file is easy with the tar:

$ tar xvjf myfile.tar.bz2
  • x tells tar to extract the archive file
  • v stands for verbose output
  • j tells tar to use bzip2 method to decompress the file
  • f means that we define the tar file name as the next argument

This will decompress the tar.bz2 file in the same folder, which is not always the desired outcome. To extract the tar file to the other folder, use -C as an argument and define the target path:

$ tar xvjf myfile.tar.bz2 -C /path/to/folder/