How To Zip Files and Folders in Linux

Last Updated: 

LINUX

How To Zip Files and Folders in Linux

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.

How To Zip Files and Folders in Linux

Learn how to zip files and folders using terminal and GUI in Ubuntu, Debian and other Linux distros.

Installing zip Utilities in Linux

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

install zip unzip Linux

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.

Zip a Folder in Linux Using Terminal

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

zip folder in linux using terminal

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.

Read: How to Install Steam on Ubuntu | Linux Mint

Zip a Folder in Ubuntu Linux Using GUI

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.

zip folder in linux using GUI

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.

zip files Linux Ubuntu

You should see the created compressed file in the same directory.

Conclusion: Create Zip Files & Folder in Linux Easily

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.

Read : 7 Best Download Managers For Linux

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.

Share

Tags:  linuxhow-toterminal
Prince Sumberia

Hi, I am Prince Sumberia, a full stack web developer and tech blogger. I love contributing to open source projects and developing cool stuff for the web.