tar.bz2 is normally the default extension for bzip2-compressed tar archive. It is used instead of the normal tar.gz format when higher compression rate is required at the expense of CPU time required to both compress and decompress an archive of this format.

tar.bz2 archive files can be extracted using tar command at the terminal which is included in most Linux distributions;

Extract bzip2-compressed tar archive in Linux:

  1. Launch your preferred terminal application.
  2. Check if file is a valid bzip2 archive (optional).
    $ file file.tar.bz2
    file.tar.bz2: bzip2 compressed data, block size = 900k
  3. Create folder where you want to extract the file onto (optional).
    $ mkdir destination
  4. Go to the target directory where you want to extract the file onto (optional).
    cd destination/
  5. Extract using tar command.
    $ tar --extract --bzip2 --verbose --file=/home/user/file.tar.bz2 #Simplified version: tar -xjvf /home/user/archive.tar.gz
    archive/
    archive/subfolder-02/
    archive/subfolder-02/filename-02
    archive/subfolder-02/filename-01
    archive/subfolder-01/
    archive/subfolder-01/filename-02
    archive/subfolder-01/filename-01
  6. View content of extracted file.
    $ ls -R
    .:
    archive
    
    ./archive:
    subfolder-01  subfolder-02
    
    ./archive/subfolder-01:
    filename-01  filename-02
    
    ./archive/subfolder-02:
    filename-01  filename-02
Leave a comment:
Share!