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:
If you want to zip a folder or directory use the following command.
$ sudo zip -r archive.zip folder_name/
Example:
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:
Important options to extend the zip functionalities
Options | Details |
---|---|
-r | recurse into directories |
-e | encrypt |
-u | Update only changed files |
-1 | To compress fast |
-9 | To 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.
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.