Enroll Course

100% Online Study
Web & Video Lectures
Earn Diploma Certificate
Access to Job Openings
Access to CV Builder



Online Certification Courses

How to Unzip ZIP Files in Linux

OS, Linux. 

How to Unzip ZIP Files in Linux

Compressing files is an excellent way to conserve storage and bandwidth while speeding up file transfers. Numerous file compression formats exist, including ZIP, RAR, and TAR. Without a doubt, ZIP is the most widely used compression format, particularly in the Windows and Linux operating systems.

Due to the fact that this guide is only for Linux-based operating systems, you can use unzip, a popular command-line tool for zipping and unzipping files on your system. 

Installation of Unzip on Linux

In Linux, the unzip command is required to perform zipping and unzipping operations. Unzip can be installed via the default package manager on almost every distro.

On Ubuntu and Debian, the following applies:

sudo apt install unzip

To install unzip on Fedora, CentOS, or any other RHEL-based distribution, follow these steps:

sudo yum install unzip

Regarding Arch Linux and its forks:

sudo pacman -S unzip

File Unzipping making use of unzip

Unzipping the ZIP file extracts all of the files contained within. By default, these files are extracted to the current directory, but this can be changed by unzipping the file to another directory.

To unzip files in Linux, use the following command:

unzip filename.zip

The preceding command outputs the names of all extracted files. The -q flag can be used to muffle the output of the command:

unzip -q filename.zip

The -q option is essentially silent, masking the output of the unzip command.

How to Extract a ZIP File into a Different Directory

You can extract the ZIP file to a separate folder to maintain the integrity of the current directory. Additionally, this organizes the extracted files and prevents them from becoming mixed up with other files in the current directory.

Use the -d flag with the command to extract files to a different directory. The -d option denotes Directory and accepts either a relative or absolute path as an argument.

unzip filename.zip -d /directory/location

Unzip a ZIP File That Is Password Protected

Password-protecting ZIP files is a common practice to ensure security and confidentiality. You can use the following command to unzip a password-protected ZIP archive:

unzip -P your_password filename.zip

where your_password is the archive's password.

Graphical Extraction of ZIP Files

Without using the command line, you can unzip a file using the traditional Extract method included in almost every mainstream Linux desktop environment.

Open the folder containing the archive, double-click the file, and then click the Extract button in the window's upper left corner.

After clicking the button, a dialog box will appear asking for the location of the extracted file. You have three options in this prompt: Maintain Directory Structure, Do not overwrite newer files, and Extract All Files. You can select the appropriate options prior to proceeding.

Select the location and click the green Extract button in the dialog box's top right corner.

This way, you can use a graphical interface to unzip a file at any location. The archive manager will extract all files to the directory specified (depending on the options you selected).

Take note that the preceding method will work only if your system comes pre-installed with an archive manager. The default archive manager in the majority of Linux desktop environments allows you to extract and create ZIP files.

Using Compressed Archive Files in Linux

If you frequently transfer multiple discrete files locally or even online, compression can save you a lot of time. You can zip the files using the unzip utility's simple zip command. The same unzip utility also assists users in extracting zip files, which makes these commands extremely useful over time.

Corporate Training for Business Growth and Schools