So you’ve been sent a .zip file as an attachment and now you’re stuck figuring how to extract it’s content? Or some such! Luckily you’ve stumbled upon the right place, as at ezyZip we eat zip files for breakfast! Linux offers various solutions to uncompressing zip files, depending on your configuration and variant.
Below we outline some common methods to unzipping files on the Linux environment.
Using the GUI to unzip files on Linux
The simplest approach is to use the GUI. Below we show the steps involved when using the default desktop environment that comes with each linux distribution. If you are using a custom setup, then these steps might not apply. Use the command line unzip options if you are stuck!
Extract zip file with Ubuntu / Debian
- Open the Files app and navigate to the directory where zip file is located.
- Locate the file which you want to unzip.
- Right click on the file and the context menu will appear with list of options.
- Select “Extract Here” option to unzip files into the present working directory or choose “Extract to...” for a different directory.
Extract zip file with Mint
- Steps are same as above. Just note that an "Extract to..." option is not provided with the default installation.
That’s it, you have successfully unzipped the file. Optionally you could also use the Gnome Archive Mananger, which offers more advanced options and support for other file types.
Other Linux unzip applications
There is a myriad of dedicated archive management applications that can be utilised for unzipping files. Some are packaged with the distribution and others can be installed separately. Archive Manager comes as a default installation with many Linux distros and is quick & easy way to decompress archives. Ark is another archive manager that ships as a default in a lot of distributions.
Extract zip file with Archive Manager
Extract zip file with Ark
Archive Manager comes as a default installation with many Linux distros and is quick & easy way to decompress archives.
Ark is another archive manager that ships as a default in a lot of distributions.
How to unzip on Linux using terminal
If you want to work like a pro and desire more powerful features, you have to move towards command line interface. Fire up your terminal and run one of the following commands to complete your desired task. The examples assume you have a filename called backup.zip.
Install unzip on Linux
If unzip command is not installed on your system, then you'll need to do that first.
sudo apt install unzip
Unzip on the Linux command line
The simplest option that will extract the contents to current directory:
To change the target directory for extracted material, use -d option followed by the desired directory:
unzip backup.zip -d ./restore-directory
To preview contents of zip file:
unzip -l backup.zip
If you don’t want to unzip the whole file, then add the specific files to extract at the end:
unzip backup.zip file1 subdirectory/file2
The inverse of the above command. Unzip every file EXCEPT the ones specified after the -x modifier:
unzip backup.zip -x file1 subdirectory/file2
Unzipping a password protected file:
unzip -p mypassword backup.zip
Unzip files on command line with unarchiver
A great free set of unarchiving command line utilities are supplied by the Unarchiver. There is a GUI too but that is currently only offered to MacOS users.
The best part about these utilities is that they support dozens of other file formats (e.g. rar, 7z, arj etc...) and the command line syntax is the same for all of them.
sudo apt-get install unar
To uncompress a file:
Uncompress file to a different directory:
unar -o ./output-directory backup.zip
Check out all the other parameters available with:
Unzip tar.gz files on command line
Linux and other unix variants commonly use tar and gz to package collection of files into a single package (e.g. software packages). To use the GUI for opening tar.gz files, follow the zip file instructions above. The command line options however are slightly different:
First uncompress the gz file:
The output of the above should be filename.tar. Now to extract the tar file contents:
tar xvf filename.tar
You can combine the above two commands by adding a "z" option:
tar zxvf filename.tar.gz
Unzip 7z files on command line
Another compression format that you will often encounter is 7z.
Install p7zip (if needed)
sudo apt-get install p7zip-full
To extract a 7z archive:
7z e backup.7z