How Unzip File in Linux from Terminal

Unzip File in Linux from Terminal

Compressed files are easy to transfer and use in a computer system. Zipping file in Linux is one of the easiest utility. By using zip command you can zip files easily without losing quality. If you want to Unzip this file then you can use unzip utility in Linux.

Install Unzip Utility

You can install unzip utility in the following ways:

Unzip on CentOS

sudo yum install unzip

Install Unzip on Ubuntu or Debian

sudo apt install unzip

Unzip on Fedora

sudo dnf install unzip

Unzip on SUSE/OpenSUSE

sudo zypper install unzip

How to Unzip File in Current Directory

Following is the simplest and easier way to unzip a .zip file in Linux without using any options but remember you should have write permission for current directory:


The above command will unzip file in the current directory and saves extracted files

How to Unzip File in Specific Directory

You can extract files in a specific directory by using -d option with unzip command. It is always required to have to write permission for a given specific directory so it is recommended to run it with sudo.

For example, the following file will be extracted inside /var/www/html/ directory:

sudo unzip -d /var/www/html/

How to Unzip File with Password

You can also extract password protected zipped files using unzip command. Below is the basic syntax for decompressing password-protected file:

sudo unzip -P PASSWORD

For example, if you want to unzip with password abc123 then you can do so by using the following command:

sudo unzip -P abc123

Check The Contents of Zip File Without Extracting

You can check or list all the zip file contents using -l option with unzip command.

For example to list all the contents of run below command:

unzip -l


You have successfully learned How Unzip File in Linux from Terminal. If you have any queries please don’t forget to comment out.