Zipping and unzipping files make complicated tasks like file transfer easier. Zip is a commonly utilized compression function that is portable and easy to use. One can even unzip files in Windows created in Linux.
Compression of files and folders allows faster and more effective transfer, storage, and emailing of files. Unzip is a tool that will enable you to decompress files. It is a utility unavailable on most Linux by default but can be installed easily. Below is an easy guide on doing a Linux zip and unzip installation.
How to Do a Linux Zip and Unzip Installation
There are different commands you ought to execute in the various Linux distributions.
How to Install Zip/Unzip in Debian and Ubuntu Systems
Install the zip tool by running;
$ sudo apt-get install zip
Sit back and wait a minute until the installation is completed. After installing, confirm the zip version installed by using the command
$ zip -v
To install the unzip utility, use an almost similar command
$ sudo apt install zip
You can also confirm the unzip tool installed using the command
$ unzip -v
How to Install Zip/Unzip in Fedora and Linux CentOS
The process is simple and can be done using the following command
To install the zip function, use
$ sudo dnf install zip
To install the unzip function, use
$ sudo dnf install unzip
You can check the path once the installation is complete using the following command
which unzip
You can also confirm if everything has been installed correctly by running the command below
unzip -v
It will give verbose with unzip utility details
Installing Zip/Unzip in Manjaro/Arch Linux
For these distributions, run the following command
$ sudo pacman -S zip
To install the unzip tool, run
$ sudo pacman -S unzip
Installing Zip/Unzip in OpenSUSE
Run the following command to install zip on OpenSUSE
$ sudo zipper install zip
To install the unzip tool, run
$ sudo zipper install unzip
Command Examples for Zipping and Unzipping Files in Linux
The basic syntax to create a .zip file is;
Zip options zipfile list_of_files
Using Linux to Unzip a File
You can use the unzip command without any options. It will unzip all the files to the current directory. An example is (the SampleZipFile is the result of your initial compression)
Unzip sampleZipFile.zip
It will be unzipped in the current folder by default, as long as you have read-write access.
Cautions for Zipping and Unzipping Linux
Files and folders can be password-protected. A password-protected .zip file can be decompressed using the -P option. Run the following command for this obstacle
Unzip -P Password sampleZipFile.zip
The Password in the command above is the password for the .zip file.
You may be asked whether you want to overwrite the current files, skip extraction for the current file, overwrite all files, rename the current file, or skip extraction for all files. The options would be as shown;
[y]es, [n]o, [A]ll, [N]one, [r]ename
Override these files by using the -o option. For instance;
Unzip -o sampleZipFile.zip
Take caution while executing this command since it will completely overwrite the existing copies.
Bottom Line
With these essentials on Linux zip and unzip commands, you can start improving your file management now. However, for newer Linux distributions, the zip and unzip tools already come pre-installed. You won’t have to worry about installation.