How to Zip a Folder in Linux Easily


Zip is one of the most popular cross-platform compression methods. Using zip, you can compress multiple files to reduce the file sizes. Also, a zip file takes less time to copy. Zip is available for Windows, Ubuntu, and Linux platforms. In this article, I am going to share how to zip a folder in Linux-based Ubuntu. So, let’s get started.

How to Zip a Folder in Linux or any Unix Platform

By default, zip isn’t installed on Ubuntu or most of the Linux based platforms. To install zip on Ubuntu run the following command.

$ sudo apt install zip unzip

Zip a Folder or Directory using Command Line

Let’s look at the basic syntax of zip command with an example.

To zip particular files in a directory, run the following command.

$ sudo zip - r file_1.txt file_2.txt file_3.txt


zip example

If you want to zip a folder or directory use the following command.

$ sudo zip -r folder_name/


zip example_2

Create an encrypted zip with a password by following command.

$ sudo zip -r -e sandbox/

When you run the command, it will ask to set password for encrypted zip.


encrypted zip

Important options to extend the zip functionalities

-rrecurse into directories
-uUpdate only changed files
-1To compress fast
-9To compress better
-v Print details info

For complete options list follow this article.

Zip a Folder from Desktop(Graphically)

Go to the file file explorer, right click on the folder and select archive from the dropdown list.

how to zip a folder in Linux


In this article, you have learned how to zip a folder in Linux. If you have any doubts feel free to contact me, I will definitely try to help you. Also, you can join our elite Facebook group to get direct help from me. If you like this tutorial, please share this article on your social media handle.


Please enter your comment!
Please enter your name here