In this tutorial, we will show you how to install Zip and Unzip on a Linux system. For those of you who didn’t know, Zip is a command-line utility tool used for compressing files and folders. Compression of files & folders enables faster and more efficient transfer, storage, and emailing of files and folders. On the other hand, unzip is a utility tool that helps you decompress files and folders. Both zip and unzip package contains programs to create a compressed file in Linux.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Zip and Unzip packages on Linux.
- A server running one of the following operating systems: Ubuntu, CentOS, and Arch Linux
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install Zip and Unzip on Linux
Step 1. First, make sure that all your system packages are up-to-date by running the following commands in the terminal.
### CentOS/RHEL-based ###
sudo dnf update
### Ubuntu/Debian-based ###
sudo apt update
### Arch/Manjaro ###
sudo pacman -Syu
Step 2. Installing Zip and Unzip on Linux.
- For Debian-based distributions, install the zip utility by running the command:
sudo apt install zip sudo apt install unzip
- For the CentOS system, install the zip utility by running the command:
sudo dnf install zip sudo dnf install unzip
- For Arch Linux-based distributions, install the zip utility by running the command:
sudo pacman -S zip sudo pacman -S unzip
Step 3. How to Unzip a ZIP File in Linux.
After installing the zip utility, you can create a zip file using the following command:
zip -r compressed_filename.zip folder_name
unzip command in Linux is simple. You need to tell
unzip the name of the
zip file which you want to unzip.
unzip compressed_filename.zip -d destination_folder
Zip Linux Command Syntax:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list] The default action is to add or replace zipfile entries from list, which can include the special name - to compress standard input. If zipfile and list are omitted, zip compresses stdin to stdout. # Here are the options that we can use with the ZIP commands- -f freshen: only changed files -u update: only changed or new files -d delete entries in zipfile -m move into zipfile (delete OS files) -r recurse into directories -j junk (don't record) directory names -0 store only -l convert LF to CR LF (-ll CR LF to LF) -1 compress faster -9 compress better -q quiet operation -v verbose operation/print version info -c add one-line comments -z add zipfile comment -@ read names from stdin -o make zipfile as old as latest entry -x exclude the following names -i include only the following names -F fix zipfile (-FF try harder) -D do not add directory entries -A adjust self-extracting exe -J junk zipfile prefix (unzipsfx) -T test zipfile integrity -X eXclude eXtra file attributes -y store symbolic links as the link instead of the referenced file -e encrypt -n don't compress these suffixes -h2 show more help
Congratulations! You have successfully installed Zip and Unzip. Thanks for using this tutorial for installing the Zip and Unzip on your Linux system. For detailed information, you can head to the command’s man page.