If you are working with an Ubuntu Linux server and you have to compress ZIP archives files or folders on your ubuntu server. Or extract/unzip the compressed ZIP archives file or folder on ubuntu. So for this, you should have zip and unzip installed in the ubuntu linux server.
Zip and unzip commands are used for creating compressed ZIP archives and extracting files and directories from existing ZIP archives, respectively in Linux ubuntu.
In this tutorial, you will learn how to install zip and unzip in linux ubuntu 22.04 server using the terminal.
How to Install zip
and unzip
on Ubuntu 22.04 using Terminal
Steps to install zip and unzip on Ubuntu 22.04 using terminal:
- Step 1: Open a Terminal
- Step 2: Update Package List
- Step 3: Install zip
- Step 4: Install unzip
- Step 5: Verify the installation
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 Package List
Before installing any software, it’s a good idea to update the package list to ensure you get the latest versions of the packages. In the Terminal, run the following command:
sudo apt update
Step 3: Install zip
To install zip, simply enter the following command in the Terminal:
sudo apt install zip
The system will ask for your user password. Enter it and press Enter
proceed with the installation.
Now that you have zip
installed it in your Ubuntu server, you can use them to compress files and directories.
To create a ZIP archive of a file or directory, use the following syntax:
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 unzip
To install unzip, use the following command:
sudo apt install unzip
Again, enter your password when prompted, and press Enter
to continue.
Now that you have unzip
installed in your ubuntu linux server, you can use them to extract files and directories.
To extract files from a ZIP archive, use the following syntax:
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
Once the installation is complete, you can verify that both zip and unzip are installed by running their version commands:
zip --version unzip --version
These commands will display the installed version numbers of zip and unzip, respectively.
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.