Linux/Unix: How To Extract and Decompress a .bz2/.tbz2 File

I‘ve a file called How do I extract or decompress a .bz2 file on a Linux or Unix-like systems using command line options?

You can decompress .bz2, .bz, .tbz2, and .tbz file using bzip2 command on a Linux or Unix-like systems such as FreeBSD, OpenBSD, OS X and more.

Tutorial details
Difficulty Easy (rss)
Root privileges No
Requirements None
Time 2m

How to decompress a .bz2 file

The syntax is:

bzip2 -d your-filename-here.bz2
bzip2 -d -v your-filename-here.bz2
bzip2 -d -k your-filename-here.bz2
bunzip2 filename.bz2


To extract a file called dfly-x86_64-4.2.0_REL.iso.bz2, enter:
bzip2 -d dfly-x86_64-4.2.0_REL.iso.bz2
To verify new file, enter:
ls -l dfly-x86_64-4.2.0_RE*
Sample outputs:

-rw-r--r--  1 vivek  wheel  634376192 Jul  1 15:57 dfly-x86_64-4.2.0_REL.iso

You can now use extracted file but this option will not preserve original archive file. To Keep (don’t delete) input files during decompression, use:
bzip2 -d -k dfly-x86_64-4.2.0_REL.iso.bz2
To see verbose output pass the -v option to the bzip2 command. The verbose mode show the compression ratio for each file processed. Further -v’s increase the verbosity level, spewing out lots of information which is primarily of interest for diagnostic purposes:
bzip2 -d -k -v dfly-x86_64-4.2.0_REL.iso.bz2
bzip2 -d -k -vv dfly-x86_64-4.2.0_REL.iso.bz2
Sample outputs:

    [1: huff+mtf rt+rld]
    [2: huff+mtf rt+rld]
    [631: huff+mtf rt+rld]
    [632: huff+mtf rt+rld]

Sample demo

Gif.01 Extract and Decompress a .bz2/.tbz2 File

Decompress a .tbz2 or .tbz or .tar.bz2 file

Use any one of the following syntax:

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:

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.

🐧 Please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
2 comments… add one
  • netlord Jul 17, 2015 @ 18:20

    hi – do you know a tool called dtrx?

    this unpacks almost every archive with one command.

    try it out.

  • Olivier Jul 20, 2015 @ 8:19

    A little tip for tar. Actually, modern tar takes care automatically of the type of compression when it decompress an archive. You don’t need to set it explicitly :

    tar xvf archive.tar tar xvf archive.tar
    tar xvf archive.tar.gz tar zxvf archive.tar
    tar xvf archive.tar.bz2 tar jxfv archive.tar

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @