How to Zip and Unzip Files and Folders in Ubuntu? A Step-by-Step Guide



When you find yourself needing to share a collection of files within a directory, opting for compression in the .zip file format proves to be a practical choice. Widely supported across various operating systems, the Zip format is renowned for its efficient archive capabilities, employing lossless data compression techniques.

In essence, a Zip file acts as a versatile container, encapsulating one or more compressed files or folders. While alternative formats like .tar are prevalent in Linux systems, the ubiquity and compatibility of the .zip extension make it a preferred choice.

There are several advantages of using a Zip file format. Firstly, it significantly reduces the disk space occupied by the compressed content. Secondly, during file transfers between machines, the Zip compression translates into noteworthy savings in network bandwidth. The compressed nature of the Zip folders facilitates quicker transfers compared to uncompressed files.

Importantly, extracting these compressed Zip folders is a seamless process. The Linux, macOS, and Windows operating systems offer a wide range of utilities to extract Zip files.

In this guide, we'll take you through the process of how to Zip a folder in Ubuntu 22.04 systems. We'll cover the steps for both command line and graphical options, ensuring you have a comprehensive understanding. Additionally, we'll delve into using popular tools like tar and gzip for efficiently zipping and unzipping multiple files and folders. Stick around to master the art of zipping and unzipping on your Ubuntu system!

Zip File Compression Methods

Zip utility employs different compression methods, with the two primary ones being "store" and "deflate."

Deflate: This is the default compression method utilized by the Zip command. Files are compressed to reduce their size within the Zip archive when deflate.

Store: The "store" method is employed when the Zip utility encounters a file that doesn't require compression. In such cases, the file is directly included in the Zip archive without undergoing the compression process.

Additionally, in many Linux distributions, the Zip command extends its support to the “bzip2” compression method, offering users flexibility in choosing the compression technique based on their preferences and requirements.

How to Zip File in Ubuntu?

The common practice in Ubuntu Linux involves utilizing the standard tar and gzip utilities, often resulting in file archives with the "tar.gz" extension. It's essential to note that despite sharing a name with Windows' built-in file extractors like PKUNZIP, WinZip, or 7-Zip, gzip creates archives that aren't compatible with these Windows utilities. 

However, the Linux Zip command line utility generates standard archives that can be extracted seamlessly on both Linux and non-Linux systems, such as Windows and Mac OS X. To delve into the process of zipping files in Ubuntu, follow these straightforward steps:

Step 1:Start by clicking on the "Dash" icon and entering "terminal" in the search box. Locate and click on the "Terminal" application icon that appears.

Step 2: Use the cd command to navigate to the folder where your Zip file is located. For instance, if your file resides in the "Documents" folder, type "cd Documents" and press enter.

Step 3: Ubuntu's versatile terminal command line empowers you to create a Zip archive, add files to it, and build the archive using the "Zip" command. For example, if you want to create a Zip archive named "testzipfile" containing the file "mydocument.doc," enter the following commands in the terminal:

$ zip testzipfile mydocument.doc

Step 4:Confirm the creation of your Zip file by typing "ls *.zip" at the command prompt and pressing enter.

How to Zip a Folder in Ubuntu Using the Command Line? (Zip a Directory)

The Zip utility is used to Zip a folder in Ubuntu. The Zip utility compresses and archives files and directories, reducing their size and facilitating efficient storage and transmission. Compressing a folder into a Zip format is important for efficiently sharing multiple files. 

You can Zip a Folder in Ubuntu using two methods: using the Gnome graphical interface environment and via the command line. Let's start with the command line method:

Step 1: Install the Zip Command-Line Utility

Before zipping a folder, ensure that the Zip command-line utility is installed on your Ubuntu system. If not, use the following commands to install it:

$ sudo apt update

$ sudo apt install zip

To verify the installation, check the version of the Zip utility:

$ zip --version

Step 2: Zip a Folder in Ubuntu OS

Now that the Zip utility is installed, you can use the following syntax to Zip a folder:

$ zip {options} folder-name

For example, if you want to zip a folder named “testzipfolder,” use the following command:

$ zip -r testfolder

Upon successful execution, the terminal will display the contents of the zipped folder, confirming the compression process. This method offers a quick and efficient way to compress folders in Ubuntu using the command line.

How to Zip Multiple Folders in Ubuntu Using Zip Utility

To zip multiple folders and files into a single archive using the Zip utility, you can utilize the following command:

$ zip -r testfolder1 testfolder2 file1.txt file2.txt

In this command:

Zip is the command to initiate the zipping process.

-r stands for "recursive," allowing the utility to include all files and subdirectories within the specified folders. is the name you assign to the resulting Zip file.

Following that, you list the folders and files you want to include in the archive:

testfolder1 and testfolder2 represent the folders you want to zip.

file1.txt and file2.txt are individual files you wish to add to the Zip archive.

So, in summary, this command creates a Zip archive named, containing the contents of testfolder1, testfolder2, file1.txt, and file2.txt.

If you have more folders or files to include, you can extend the command by listing them after the archive name. For example:

$ zip -r docs_folder test_folder testfile1.txt testfile2.txt testfile3.txt

This command creates a Zip archive named comprising the contents of docs_folder, test_folder, and the specified text files.

How to Zip a Folder in Ubuntu With Password Protection

To enhance the security of your information stored in a Zip archive, you can create a password-protected Zip file using the -e option for archive encryption. Here's a detailed explanation:

Open your terminal on your Linux system using “Ctrl + Alt + t” or from the application menu.

$ zip -e directory_name

Zip is the command to initiate the zipping process.

-e is the option for archive encryption, indicating that you want to create a password-protected Zip file. is the name you choose for the resulting Zip file.

directory_name represents the directory you want to compress and protect with a password.

After entering the above command, the terminal will prompt you to enter and verify a password for the archive. Type the password and press enter. Note that the password characters won't be visible on the screen for security reasons.

Confirm the password by entering it again when prompted.

Once you've completed these steps, the specified directory will be compressed into a password-protected Zip file with the given name. To access the contents of this Zip file in the future, you'll need to provide the password you set during the creation process.

This method ensures an additional layer of security for sensitive information stored within the Zip archive.

How To Split Zip Files in Ubuntu

At times, you may encounter the need to upload files to another server or file hosting service with specific size limitations, such as 100 KB per file. 

For example, if you have 2 MB of data to upload, but the destination supports only 100 KB files, a solution is to create split archive files.

By using the “-s” option, followed by the desired archive file size limit, you can efficiently create split archive files. When the specified limit is reached, the following command generates a new Zip archive file in the home directory:

$ zip -s 100k -r directory_name

This command breaks down the data in the specified directory into 100 KB segments, facilitating seamless file uploads or transfers. Explore this method to streamline your Linux file size management and make the most of your opportunities.

How to Zip a Folder in Ubuntu Using Graphical User Interface (GUI)

If you prefer a graphical approach to zip a folder in Ubuntu, utilizing the Gnome desktop environment is an easy alternative to the command line. Follow these steps:

Step 1: Navigate to the Folder

Open the Gnome desktop and locate the folder you want to zip.

Step 2: Select the Folder

Right-click on the desired folder. A menu will appear; choose the “compress” option from the list.

Step 3: Choose Compression Format

After selecting “compress,” a submenu will prompt you to choose the compression format. Click on “Create” after selecting the “.zip” extension.

Now, you will assign a suitable name to the Zip archive. So, provide a name for the Zip folder when prompted. Upon clicking “Create,” the compressed archive will be generated in the current directory where the original folder is located.

This graphical method simplifies the process of zipping folders in Ubuntu for users who prefer an interface-based approach over the command line.

How to List Content of a Zip File in Ubuntu

If you want to view the contents of a Zip file in Ubuntu, you can perform the following steps in the terminal:

  • Step 1: First, open the Terminal on your Ubuntu system.
  • Step 2: If you haven't installed the "unzip" utility, you can do so by using the following command:

$ sudo apt-get install unzip

This command installs the unzip utility that is necessary for extracting and listing the contents of Zip files.

  • Step 3: Navigate to the directory containing the Zip file using the "cd" command. For instance, if your Zip file is in the "Documents" directory, enter:

$ cd Documents

  • Step 4: Now, use the following command to display the contents of the Zip file:

unzip -l

Replace "" with the actual name of your Zip file and press enter.

You'll now see a list of all the files and directories contained within the Zip file.

How to Unzip Multiple Zip Files in Ubuntu

Using the Uzip utility, you can extract the contents of multiple Zip files within a directory in Ubuntu. To unzip multiple Zip files, use the following command:

$ unzip '*.zip'

This command extracts files from all Zip archives in the current directory and places them in the same directory. If you wish to extract the files to a specific directory, replace the "." in the command with the desired path.

To confirm the extraction, use the "ls" command to list the files in the directory:

$ ls

This will display a list of all the files that have been successfully extracted from the Zip files.


Exploring the efficiency of the .zip file format for compression not only optimizes storage but also accelerates file transfers across diverse systems. This guide has provided insights into zipping a folder in Ubuntu through both the command line and GUI methods. 

Additionally, we've practiced multiple examples illustrating how to Zip files in Ubuntu and unzip multiple files simultaneously with a single command. This straightforward approach empowers users to efficiently manage file compression and extraction on their Ubuntu systems.

If you're currently seeking a reliable hosting solution for your VPS or dedicated server needs, or if SSL services are on your checklist, Host World has you covered. With a comprehensive range of services, Host World ensures dependable and tailored solutions to meet your hosting requirements.

Items from an article
  • Intel Xeon E-2286G
    • Country: United States
    • CPU 6x 4.00 GHz (Single 6 Core)
    • RAM 32GB RAM DDR4
    • HDD 2x 1TB SATA 7.2k RPM
    • BANDWIDTH 100 Mbit
    • IPv4 / IPv6
    € 124/month
    • CPU 2 x Xeon Core
    • RAM 2 GB
    • HDD 30GB
    • BANDWIDTH 1 Gbps
    • IPv4 / IPv6
    € 9/month
    • Country: Australia
    • City: Sydney
    • CPU 2 x Epyc Core
    • RAM 4 GB
    • HDD NVMe : 50GB
    • BANDWIDTH 1 Gbps port
    • IPv4 / IPv6
    € 20/month
  • KVM VPS 8 GB
    • Country: Cyprus
    • City: Limassol
    • CPU 4 x Xeon Core
    • RAM 8 GB
    • HDD 200GB
    • BANDWIDTH 100 Mbit port
    • IPv4 / IPv6
    € 70/month
Blog company: