If you are working with an Ubuntu 22.04 Linux server, you need to compress ZIP archives files or folders, Or extract/unzip the compressed ZIP archives file or folder. Now, you should have zip and unzip libraries installed in the Ubuntu Linux server, If these are not, to install them, you need to type sudo apt-get install zip and sudo apt-get install unzip commands on the terminal window and press Enter.
Zip and unzip commands are used for creating compressed ZIP archives and extracting files and directories from existing ZIP archives, respectively in Linux Ubuntu.
How to Install zip
and unzip
on Ubuntu 22.04 using Command Line
Here are steps to install zip and unzip on Ubuntu 22.04 using the terminal:
Step 1: Open a Terminal
To install zip and unzip, you’ll need to use the Terminal. You can open the Terminal by pressing Ctrl + Alt + T
or by searching for “Terminal” in the Ubuntu Activities search bar.
Step 2: Update System Packages
To setup unzip zip on Ubuntu Linux, it is necessary to update all packages on your server, to update system packages you can use:
sudo apt update
Step 3: Install the zip on Ubuntu Linux
To install zip in Ubuntu, type sudo apt install zip command on terminal window to install it in your system or server:
sudo apt install zip
The system will ask for your user password. Enter it and press Enter
proceed with the installation.
After installing Zip, if you are compressing or zip any file or directory in your system or server, you can use the below-given syntax for the same:
To create a ZIP archive of a file or directory:
zip [options] archive_name.zip file1 file2 file3 ...
For example, to create a ZIP archive named my_archive.zip
containing file1.txt
and file2.txt
, you would run:
zip my_archive.zip file1.txt file2.txt
Step 4: Install the unzip on Ubuntu Linux
To install unzip in Ubuntu, type sudo apt install unzip command on terminal window to install it in your system or server:
sudo apt install unzip
Again, enter your password when prompted, and press Enter
to continue.
After installing unZip, if you are extracting or unzip any file or directory in your system or server, you can use the below-given syntax for the same:
To extract files from a ZIP archive:
unzip archive_name.zip
For example, to extract all files from my_archive.zip
, you would run:
unzip my_archive.zip
Step 5: Verify the installation
To install zip and unzip, you just have to use 2 commands, those commands have been seen in step 3 and 4 of our article guide, f you want to check the version of zip and uzip, this you can use the command given below:
zip --version unzip --version
These commands will display the installed version numbers of zip and unzip, respectively.
Here is the video guide on how to install zip and unzip on ubuntu linux:
Conclusion
That’s it! You have successfully installed zip and unzip on Ubuntu 22.04 using terminal. Now you can use these utilities to compress and extract files in your Ubuntu system.