How To Unzip Files Using Command on Linux

How To Unzip Files Using Command on Linux

Zip command will be useful when you want to download a large file on a Linux operating system or Linux server, but you have a limited internet package; The main function of ZIP is to compress files to reduce their size; In contrast, the UNZIP command will allow us to extract various ZIP files.

The Ways To Unzip Files On A Linux VPS

1) Extract files normally without a specific prefix or suffix

2) Unzip files in the desired directory

3) Unzip the files without displaying the contents

4) List the contents of a zipped file

5) Extract only certain contents of a file

6) Unzip multiple files at once

7) Unzip encrypted files

In order to be able to open a zip file, you need to have the unzip package installed on your system, Most modern Linux distributions support the unzip package; So you do not need to do anything; It should be noted that the file compression rating is adjustable from 0 to 9, which is normally set to 6.


Is It Correct To Re-Compress The File To Increase Security?

This attitude is completely wrong, first, it is better to note that, re-compressing a file, in addition, does not cause further compression; At the same time, in some cases, it even increases the file size and will not have a significant effect on increasing file security.


Need To Install A Special Command To Extract The Files?

Normally, there is an Unzip command for each Linux distribution, and you can use it to extract files; But if you could not use the command in any way, you can access Unzip using the following command; Use the below commands to install Unzip:

# For CentOS, Redhat, and Fedora

dnf install unzip

# For Debian-based

apt install unzip

# For Arch, Manjaro Linux

pacman -S unzip

# For OpenSUSE

zypper install unzip

Confirm The Version Of The Unzip

unzip -v


1- Unzip In Normal Mode

Using the following command, all compressed files are extracted together in the same directory as the compressed file:


2- Unzip Files In The Desired Directory

If you want to select a specific extraction path for the file; You can use the following command;

unzip -d /directory-path

3- Exceptions For Extracting Some Files

If you do not intend to extract certain contents from the zipped file, you can use the following command and except for the specified items, all the contents of the file will be extracted:

unzip -x file-exclude1 file-exclude2

4- Unzip Multiple Files At Once

In order to extract all the files in a directory, the following command can be used:

unzip '*.zip'

5- Unzip The Files Without Displaying The Contents

In order not to write the names of the contents of the files during the extraction or not to display the summary of the extractions, you can use the following command:

unzip -q

6- List The Contents Of A Zipped File

The following command is used to check the contents of the compressed file; You can use the following command

unzip -l

7- Unzip Encrypted Files

You can Unzip the protected zip files with the following command; Just keep in mind that extracting encrypted files using Linux commands is not very secure, and it is better to transfer the files to your system with WinSCP and then open the files:

unzip -P Password



You can use the Zip Cloak command to apply your password to the compressed file.

Leave a Reply

Your email address will not be published. Required fields are marked.