In this blog, different methods have been explored by which we can zip a folder in Ubuntu 22.04.
How to ZIP a Folder in Ubuntu 22.04?
There are two different methods to ZIP a folder in Ubuntu:
Method 1: How to ZIP a folder in Ubuntu 22.04 using the terminal
To zip a folder in Ubuntu, first install the ZIP utility in Ubuntu by executing the below-mentioned command:
To confirm the successful execution of the above command, check the installed version of ZIP utility:
In the above screenshot, the “Zip 3.0” is confirming that the utility of ZIP has installed.
What is the utilization of the ZIP utility in zip a folder?
The general syntax of using the ZIP utility to ZIP a folder is:
Following the above syntax:
- use the zip utility.
- Then, choose the zip utility options according to your requirement.
- A new name for the zipped folder with zip extension.
- Lastly, the folder name is going to be zipped.
Suppose we have a directory with the name “LinuxHintFiles1” in our home directory and we want to compress it:
And this folder contains a couple of files in it as well:
In the above output, it can be seen that the folder, “LinuxHintFiles1” contains seven different files.
To zip the “LinuxHintFiles1” folder using the ZIP utility, use the below-mentioned command:
In the above command, the option “-r” of the ZIP utility has been used to move the folder into the zip file format.
To confirm the compression of the folder using the ZIP utility, again list down the contents of the directory:
In the above figure, the red color of the folder shows that it has been zipped. There are many other options that can be used with the ZIP utility and can be found by running the command:
Different options with their specific usage have been displayed on the screen.
Method 2: How to ZIP a Folder in Ubuntu 22.04 using a GUI method
To ZIP a folder through the GUI interface, right-click on the folder which is supposed to be archived:
Choose the “Compress…” option from the drop-down menu:
Type the name for the zipped folder and click on the “Create” button on the top of screen:
The Zipped folder has been created:
It can be verified that the zip folder has been created.
A Zip utility can be used to zip a folder using the command ”zip -r [name.zip] [folder name]” in Ubuntu 22.04 to change its format to archived. In this blog, the folder has been zipped by two different approaches, one is by using the GUI approach, and the other one is through the command-line interface.