How to unzip a zip file from command line and GUI

You might think that zip files belong on Windows, not Linux systems. Still, it’s a popular compression method and chances are that you’ll run across them online from time to time. Either that, or your Windows buddy will send you a zip file that you want to open.

In this guide, we’ll show you how to unzip (decompress) zip files on Linux. You’ll learn a command line method as well as a GUI method in the step by step instructions below.

In this tutorial you will learn:

  • How to unzip a zip file via command line
  • How to unzip a zip file via GUI

Unzip command on Linux

Unzip command on Linux

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux disto
Software unzip
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Unzip a zip file via command line

Your system will need a utility called “unzip” in order to extract files from zip archives, and it may or may not be installed by default already. If not, here is the command to install it on various distributions:

On Ubuntu, Debian, and Linux Mint:

$ sudo apt install unzip


On Arch Linux and Manjaro:

$ sudo pacman -S unzip

On Red Hat, Fedora, and CentOS:

$ sudo dnf install unzip

Once the package has been installed, you can use the following command syntax to extract files from a zip archive:

$ unzip archive-name.zip
Unzip a zip file via command line

Unzip a zip file via command line

If you want to extract the files and folders to a particular directory, you can specify the directory path with the -d option:

$ unzip archive-name.zip -d /path/to/directory


Unzip a zip file to specific directory

Unzip a zip file to specific directory

Unzip a zip file via GUI

We’re using GNOME in our example below. If you’re using a different desktop environment, the menus may look a little different but the instructions are likely to be very similar.

To unzip a zip file, all you need to do is right click the file and select either “extract here” to extract the files into the current directory or “extract to” to specify a different directory for the files to be extracted to.

Extraction options are found in the right click context menu

Extraction options are found in the right click context menu

Additionally, you can simply double click on the zip archive to open it and browse the contents. From there, you can extract individual files.

Conclusion

In this guide, we saw how to unzip/decompress zip archives from the command line and GUI. Zip files are the most used compression format, so it’s very useful to know how to open them.



Comments and Discussions
Linux Forum