How to Zip a Folder in Linux Easily

0

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 archive.zip file_1.txt file_2.txt file_3.txt

Example:

zip example

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

$ sudo zip -r archive.zip folder_name/

Example:

zip example_2

Create an encrypted zip with a password by following command.

$ sudo zip -r -e archive.zip sandbox/

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

Example:

encrypted zip

Important options to extend the zip functionalities

OptionsDetails
-rrecurse into directories
-eencrypt
-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

Conclusion

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.

LEAVE A REPLY

Please enter your comment!
Please enter your name here