ZIP is a one of the most common method to create a compressed archive file that was created in 1989. Since linux unzip is used widely in the world today, then you can see it everywhere on the internet. In this article, I will show you how to use unzip command in Linux.
Install unzip linux
Firstly, make sure unzip package is already installed on your system, you can use ‘which unzip‘ command to check. The most moderm Linux distribution come with unzip support but no harm in verifying it by reinstall unzip.
Use this command to install unzip on Ubuntu or debian based distribution.
sudo apt install unzip
Once you have done the above command, let’s start to unzip a zip file in Linux.
How to unzip file on Linux
There are two ways to unzip a zip file on Linux: unzip file via command line or unzip file via GUI.
Unzip file via command line
Using unzip command on terminal is the easiest way and it’s very simple. In the directory containing zip file, use this command:
There is a problem when you extract a zip file at current directory. That’s not a pretty thing, because you may move those files to another directory after extracting.
This command will show you how to extract a zip file to a specific directory. If destination directory is not existed, it will create a new one. By using this comand:
unzip zipped_file.zip -d unzipped_directory
With the above command, all files inside zipped_file.zip file will be extracted to unzipped_directory directory.
In case you want to see which file inside zip file, you can use this command to check with -l option.
unzip -l zipped_file.zip
When you excute the above command, you will get the output like this:
unzip -l metallic-container.zip Archive: metallic-container.zip Length Date Time Name --------- ---------- ----- ---- 6466010 2021-05-07 10:10 file-temp.jpg 2362 2021-05-07 13:29 temp.txt --------- ------- 6468372 2 files
There are many options of unzip command in Linux. But I think with the above commands are enough knowledge to extract a zip file.
Unzip file via GUI
If you have just started using Linux and are not familier to use terminal, there is a solution for you to unzip a zip file on linux by Graphic User Interface. I am using GNOME Desktop on Ubuntu 20.04 and the process is pretty much the same with other Linux distributions.
Firstly, open file manager and go to directory where storing zip file. Click right mouse to zip file and you will see the option “extract here“. And select that option.
Unlike unzip command which I have shown you above – the “extract here” option via GUI will create a new folder with the same name as zip file and the content of zipped file are extracted to a newly created folder.
If you want to extract all content of zipped folder to a specific folder. There is “extract to” option for you to do that.
In this guide, I have shown you two ways to unzip a zipped file in Linux by command line and graphic user interface. If you have any question about unzip command, don’t be afraid to contact us to get more information!