Archive(zip) files reduce space consumption to make the data transferable. That’s why most files you download from the web are in zip formats like tar, zip, and rar. However, you first need to unzip these files to access the data.
Although a few tools are available to unzip files, Linux contains simple commands that can be used to unzip files quickly. Therefore, in this quick tutorial, we will explain different ways to unzip files in Linux. In this section, we have included commands and graphical tools to unzip files without getting errors.
From File Manager
If you are new to Linux, we recommend that you use the File Manager to unzip the files. First, open the File Manager and go to the directory where you saved the zip file.
Now, right-click on the file; you will get two “extract here” and “extract to” options. So please choose “extract here” to unzip the file in the same directory or “extract to” to unzip the file in any other directory.
In case the zip file is password protected, the system will give you a pop-up window to enter the password:
The unzip Command
If you’re specifically dealing with a zip format file, use the unzip command. Otherwise, you can jump right into the next section. To unzip a file using the unzip command, first navigate to the directory where the zip file is located. For example, let’s open the Downloads directory:
Now use the unzip command in the following manner:
If you want to list the content of a zip file, then please use the -l option:
You can also extract the zip file data in any other directory by using the -d option:
In case the zip file is password protected, you need to use the -P option, including the password in the command:
The tar Command
The tar is the second most commonly used archive format after ‘zip’, which makes it equally essential to be aware of. For unzipping ‘tar’ files, Linux provides the tar command that can handle formats like ‘.tar,’ ‘.tgz,’ ‘.taz,’ ‘.tar.xz’, and more. Let’s take an example of a zip file, ‘Scripts.tar,’ and unzip it using the tar command:
Furthermore, if the tar archive is compressed using gzip and bzip2, use the ‘-z’ or ‘-j’ options, respectively. For instance, had the file in the above example been ‘Scripts.tar.gz’ or ‘Scripts.tar.bz2’, we would have used:
A Quick Wrap-up
Unzipping a file is a fundamental task, and as a Linux user, you must know the various methods to unzip a file. This short guide explains the two common commands that let you unzip files of different archive formats. For the zip format, the straightforward approach is via the unzip command, whereas for other formats, you must use the tar command.