How to Extract ‘tar.bz2’ and ‘tar.gz’ file in Linux

In this post i will show you on how to extract the “tar.bz2” and “tar.gz” file in Linux operating system. Below are the definition of tar and it’s operation options.

NAME
       tar - The GNU version of the tar archiving utility

SYNOPSIS
       tar  [options]

       Operations:
       [-]A --catenate --concatenate
       [-]c --create
       [-]d --diff --compare
       [-]r --append
       [-]t --list
       [-]u --update
       [-]x --extract --get
       --delete

       Common Options:
       -C, --directory DIR
       -f, --file F
       -j, --bzip2
       -p, --preserve-permissions
       -v, --verbose
       -z, --gzip

To extract a tar.bz2 file, use the command below

[root@server ~]# tar -jxvf ebook.tar.bz2

Meanwhile, To extract a tar.gz file, use the command below:

[root@server ~]# tar -zxvf ebook.tar.gz