How to Unzip Files in Linux (with Examples)

This article will explain how to use the unzip command in Linux to list, test, and extract compressed ZIP archives.

Transferring data between computers and servers is made simple and efficient by zipping files.

When files are compressed, they save disk space on a local drive and make it easier and more convenient to download files from the internet, using far less bandwidth than sending full-size files in most cases.

So youโ€™ve been sent a zip file, and now youโ€™re stuck figuring out how to unzip itโ€™s content on Linux? You can use the unzip command to extract (unzip) the file on Linux.

First, you must install unzip because it is not installed by default in most Linux distributions.

Install unzip command on Fedora / Redhat / AlmaLinux / Rocky Linux

sudo dnf install unzip

Install unzip command on Ubuntu / Debian / Linux Mint

sudo apt install unzip

How to Unzip a ZIP File in Linux

Using unzip command in Linux is absolutely simple. You need to tell unzip the name of the zip file which you want to unzip.

unzip <archivename>Code language: HTML, XML (xml)

For example, in the directory, where you have a zip file named my-archive.zip, to unzip it, the command would be:

unzip my-archive.zipCode language: CSS (css)
How to Unzip a ZIP File in Linux

Just like zip, unzip has a -q (quiet) option so that you do not need to see the file listing as the files are extracted.

unzip -q my-archive.zipCode language: CSS (css)

Unzip File in Linux to a Directory

In addition, a good practice is to unzip to a directory in the Linux command line. This way, all the extracted files are stored in the directory you specified.

If the directory doesnโ€™t exist, it will create one.

unzip my-archive.zip -d my_files/
Unzip File in Linux to a Directory

How to List the Content of a ZIP file

You can list the content of the zip file without even extracting it with the -l option.

unzip -l my-archive.zipCode language: CSS (css)
List the Content of a ZIP file

Testing a ZIP Archive’s Integrity

Sometimes you may want to test a zip archive without extracting it. To test the validity of the zip file, pass option -t as shown below.

unzip -t my-archive.zipCode language: CSS (css)
Testing a ZIP Archiveโ€™s Integrity

This option extracts each specified file in memory and compares the CRC (Cyclic Redundancy Check, an enhanced checksum) of the expanded file with the original’s stored CRC value.

Conclusion

Now you know how to unzip files in Linux. For detailed information, you can head to the commandโ€™s man page.

In addition, our excellent guide, “How to Extract tar.gz File in Linux by Using the Command Line,” will show you how to extract and work with the other widely popular Linux archive format, .tar.gz.

Feel free to leave a comment if you have any questions.

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Think You're an Ubuntu Expert? Let's Find Out!

Put your knowledge to the test in our lightning-fast Ubuntu quiz!
Ten questions to challenge yourself to see if you're a Linux legend or just a penguin in the making.

1 / 10

Ubuntu is an ancient African word that means:

2 / 10

Who is the Ubuntu's founder?

3 / 10

What year was the first official Ubuntu release?

4 / 10

What does the Ubuntu logo symbolize?

5 / 10

What package format does Ubuntu use for installing software?

6 / 10

When are Ubuntu's LTS versions released?

7 / 10

What is Unity?

8 / 10

What are Ubuntu versions named after?

9 / 10

What's Ubuntu Core?

10 / 10

Which Ubuntu version is Snap introduced?

The average score is 68%