Categories: Ubuntu

How to ZIP a Folder in Ubuntu 22.04

ZIP is an archive file format that helps you to organize your files by making them compressed in a single folder or directory. The benefit of zipping a folder is that it contains all those files which are necessary but required after some time. We zip those files by compressing them and storing them in a computer that occupies less space and can be unzipped later when needed.

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:

$ sudo apt install zip -y

To confirm the successful execution of the above command, check the installed version of ZIP utility:

$ zip –version

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:

$ zip [options] [folder name with .zip extension] [Folder name which is to be zipped]

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.

Example
Suppose we have a directory with the name “LinuxHintFiles1” in our home directory and we want to compress it:

$ ls

And this folder contains a couple of files in it as well:

$ ls LinuxHintFiles1

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:

$ zip -r myZippedFolder.zip LinuxHintFiles1

In the above command, the option “-r” of the ZIP utility has been used to move the folder into the zip file format.

Sponsored

To confirm the compression of the folder using the ZIP utility, again list down the contents of the directory:

$ ls

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:

$ zip –help

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.

Conclusion

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.

Ubuntu Server Admin

Recent Posts

Building RAG with enterprise open source AI infrastructure

One of the most critical gaps in traditional Large Language Models (LLMs) is that they…

5 hours ago

Life at Canonical: Victoria Antipova’s perspective as a new joiner in Product Marketing

Canonical is continuously hiring new talent. Being a remote- first company, Canonical’s new joiners receive…

1 day ago

What is patching automation?

What is patching automation? With increasing numbers of vulnerabilities, there is a growing risk of…

2 days ago

A beginner’s tutorial for your first Machine Learning project using Charmed Kubeflow

Wouldn’t it be wonderful to wake up one day with a desire to explore AI…

3 days ago

Ubuntu brings comprehensive support to Azure Cobalt 100 VMs

Ubuntu and Ubuntu Pro supports Microsoft’s Azure Cobalt 100 Virtual Machines (VMs), powered by their…

3 days ago

Ubuntu Weekly Newsletter Issue 870

Welcome to the Ubuntu Weekly Newsletter, Issue 870 for the week of December 8 –…

4 days ago