Since this guide is for Linux-based OSes only, you can use unzip, a popular command-line tool for zipping and unzipping files within your system.
Installing unzip on Linux
The unzip command is necessary to perform zipping and unzipping tasks in Linux. You can install unzip on almost every distro using the default package manager.
On Ubuntu and Debian:
To install unzip on Fedora, CentOS, or other RHEL-based distros:
On Arch Linux and its derivatives:
Unzipping Files Using unzip
The unzipping process extracts all the files present inside the ZIP file. These files are extracted to the current directory by default, but you can change this by unzipping the file to a different directory.
Use the following command to unzip files in Linux:
The aforementioned command prints the name of all the extracted files in the output. You can mute the output of the command using the -q flag:
The -q essentially stands for quiet, hiding the output of the unzip command.
Unzip a ZIP File to a Different Directory
You can extract the ZIP file to a separate folder to keep the current directory prim and proper. This also arranges the extracted files and ensures they don’t get mixed with other files present in the current directory.
To extract files to a different directory, use the -d flag with the command. The -d flag stands for Directory and takes a relative or absolute path as the argument.
Unzip a Password Protected ZIP File
Protecting ZIP files using a password is a common practice to ensure security and maintain confidentiality. You can unzip a password-protected ZIP archive using the following command:
…where your_password is the password for the archive.
Extracting ZIP Files Graphically
To unzip a file without using the command line, you can use the traditional Extract method provided in almost every mainstream Linux desktop environment.
Open the folder containing the archive, double-click the file, and click on the Extract button at the very top left of the window.
Once you click on the button, a dialog box will open asking you for the location where you would like to save the extracted file. In this prompt, you have options to Keep Directory Structure, Do not overwrite newer files, and Extract All Files. You can choose the relevant options before proceeding.
Select the location and click on the green Extract button, located at the top right of the dialog box.
This way, you can unzip a file at any location using a graphical interface. The archive manager will extract all the files at the specified location (depending on the options you selected).
Note that the aforementioned method will only work if your system has a preinstalled archive manager. Most Linux desktop environments have a default archive manager that you can use to extract and create ZIP files.
Working With Compressed Archives in Linux
Compression can save plenty of time if you frequently transfer multiple discrete files locally or even online. You can zip the files using the simple zip command included in the unzip utility. The same unzip utility helps users in extracting zip files, making these commands really useful in the long run.