Linux commands for extracting compressed Files zip, tar and tar.gz Files

tar or zip program allows us to create archives combining multiple files. When a file is compressed using gzip compressor it will be in .gz extension. Below are the commands to to uncompress tar and tar.gz archives.

tar xvzf filename.tar.gz

x: To extract files.

v: This will list all of the files one by one in the archive.

z: The z option is to uncompress the file (gzip).

f: To provide a file name to work with.


Below is the command to uncompress tar file.

tar xvf filename.tar.gz

For zip files in linux you can unzip the below command.


If an error message is thrown as "– bash: unzip: command not found" follow the below steps.

Debian and Ubuntu Run:

apt-get install unzip

Red Hat Linux/Fedora/CentOS users Run:

yum install unzip