Learn how to zip files and folders in Ubuntu and other Linux distributions with this step by step guide.
Zip is one of the most popular file formats for compressing files and folders. By compressing your files and folders into a single compressed file you can save storage space.
Moreover, if you have to send it over the internet, it will save your bandwidth as well.
Winrar is the most popular software for Windows for compressing files and folders. Though it is available for Linux as well but is limited to the command line only.
So, if you are a newbie to Linux you might want rather a much simpler utility or a graphical utility.
So, in this post, we will share two methods to create zip files and folders in Linux both using the command line and GUI.
Learn how to zip files and folders using terminal and GUI in Ubuntu, Debian and other Linux distros.
Using Zip utilities is one of the simple and straightforward ways to zip and unzip files and folders on the Linux operating system. To use zip, you need to make sure it is installed.
To install zip on Linux for zipping and unzipping files and folder via Linux terminal follow the following steps.
1. Open terminal.
2. Use the following command to install zip.
sudo apt install zip unzip
Now wait for some time and once the installation is finished, you will have a system that supports zip.
Now we look at how to zip and unzip files in folders using zip utility in Linux.
Now zip is installed on your Linux operating system, now you can use zip to zip folders easily using simple Linux commands. Using zip is straightforward, the syntax looks like the following.
zip [option] output_file_name file folder
You can add as many files and folders as you like. You need to run this command in the terminal.
For example, you want to zip files hello.txt and images folder to a zip file named compress.zip.
You will have to use the following command in the terminal and press enter.
zip -r compress.zip hello.txt images
After the operation is complete, you will have a zip folder named compress.zip which will have all your files and folder compressed in it.
-r is one of the many options you can use with zip command. -r option recurses into directories and compresses its contents as well.
-e is another useful option that you can use for creating password-protected zip folders.
zip -re output_file.zip file1 folder1
Now we shall look at a graphical program to zip files and folder in Linux.
Zipping files and folder in Linux using GUI is also simple and straightforward. Follow the following steps.
1. Browse to file or folder that you want to compress.
2. Now select the files and folders that you want to compress.
3. Now, right-click and click Compress.
4. You can create a compressed archive file in the zip, tar.xz or 7z format.
Just name the zip and select the format in which format you want to compress it and finally click create.
You should see the created compressed file in the same directory.
That's all! These were the two simple methods to create a zip file and folders in Linux. You can either use terminal commands or use the GUI method to create zip files.
If you have any questions please let me know in the comment section. If you found this article helpful, make sure to share it on social media.