How to Unzip a Zip file in Linux

ZIP is the most widely file extension used format for compressing files without losing data. A ZIP file, like other archive file formats, is simply a collection of files and folders compressed into a single file for easy sharing and transporting.

But when you want to use the files inside the ZIP file, you need to extract it. To extract these files you need to use a tool like Unzip in Linux. So here in this tutorial, we show you how to unzip a zip file in Linux PC.

What is Unzip?

Unzip is a utility that helps you extract compressed files from a ZIP file.

How to Install Unzip on Linux

Unzip might not be installed by default in your Linux OS. But its quite easy to install Unzip, just type the command below in the terminal depending on your distro.

how to unzip a zip file in Linux

Install Unzip in Ubuntu and Debian

sudo apt install unzip

Install Unzip on Arch Linux or Manjaro

sudo pacman -S unzip

And to install Unzip on Fedora or CentOS

sudo yum install unzip

These commands will install Unzip utility on your system.

How to Unzip a zip file

When you are done installing Unzip just navigate to the place where the zip file is located and open a terminal there. You can also open that directory in the terminal by using the cd command.

In terminal type the command below to extract the data from ZIP file. The file will be extracted in the same directory where the ZIP file is present.

unzip filename.zip
unzip a zip file

For example, if you have a file in Downloads, first type cd Downloads in the terminal. And then type unzip filename.zip.

Although to extract a ZIP file into a directory, the user needs to have write permissions of that directory.

How to Unzip a ZIP file to a different directory

Unzip command by default extracts files in the current directory, that is the is directory where the file is present. This is not a good thing as it will dump all the contents of the zip file which might be more than 100 files. So To extract files in a different folder or directory use the command below.

unzip filename.zip -d /path/of/directory

For example, if you have a file in Downloads that you want to unzip in a folder named NewFolder inside Downloads then use the command below.

sudo unzip filename.zip -d /NewFolder
Unzip a zip file in a different directory

If the directory does not exist then this command will create one.

Unzip zip files in Linux using GUI

You can even Unzip ZIP files without opening the terminal every time. Open file manager and navigate to the location of the ZIP file. Right-Click on the file and select Extract here.

This is how to unzip a zip file in Linux. We hope you like the article, if you have any questions do ask in comments we would love to help you.

If you are interested in trying new Linux Operating systems than here how to install Elementary OS – A very elegant and sleek Linux OS for beginners.

Leave a Reply

Share via
Copy link