> ## Content Index
> Fetch the complete content index at: https://itsfoss.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Zip Files and Folders in Linux
- URL: https://itsfoss.com/linux-zip-folder/
- Published: 2019-04-13T16:16:10.000Z
- Updated: 2023-05-29T05:55:31.000Z
- Description: This quick tip shows you how to create a zip folder in Ubuntu and other Linux distributions. Both terminal and GUI methods have been discussed.
- Author: Abhishek Prakash
- Tags: Quick Tip

Zip is one of the most popular archive file format out there. With zip, you can compress multiple files into one file. This not only saves disk space, it also saves network bandwidth. This is why you’ll encounter zip files almost all the time.

As a normal user, mostly you’ll [unzip files in Linux](https://itsfoss.com/unzip-linux/). But how do you zip a folder in Linux? This article helps you answer that question.

**Prerequisite: Verify if zip is installed**

Normally [zip](https://en.wikipedia.org/wiki/Zip%5F%28file%5Fformat%29?ref=itsfoss.com) support is installed but no harm in verifying. Open a terminal and use the following command:

```
zip --version
```

If you see some details on the zip version, you have zip installed already. If it displays ‘zip command not found’, you can run the below command to install zip and unzip support in Ubuntu and Debian based distributions.

```
sudo apt install zip unzip
```

Now that you know your system has zip support, you can read on to learn how to zip a directory in Linux.

## Zip a folder in Linux Command Line

The syntax for using the zip command is pretty straightforward.

```
zip [option] output_file_name input1 input2
```

While there could be several options, I don’t want you to confuse with them. If your only aim is to **create a zip folder** from a bunch of files and directories, use the command like this:

```
zip -r output_file.zip file1 folder1
```

The `-r` option will recurse into directories and compress its contents as well. 

💡

The .zip extension in the output files is optional as .zip is added to the output file by default.

You should see the files being added to the compressed folder during the zip operation.

```
zip -r myzip abhi-1.txt abhi-2.txt sample_directory
  adding: abhi-1.txt (stored 0%)
  adding: abhi-2.txt (stored 0%)
  adding: sample_directory/ (stored 0%)
  adding: sample_directory/newfile.txt (stored 0%)
  adding: sample_directory/agatha.txt (deflated 41%)
```

You can use the `-e` option to [create a password protect zip folder in Linux](https://itsfoss.com/password-protect-zip-file/).

[How to Create a Password Protected Zip File in LinuxBrief: This simple tutorial shows you how to create a password protected zip file in Linux both in command line and graphical way. We have seen how to password protect folders in Ubuntu earlier. We have also seen encrypted text editor for Linux. Today, we’ll see how to create![](https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png)It's FOSSAbhishek Prakash![](https://itsfoss.com/content/images/wordpress/2016/01/password-protect-zip-files-in-linux.jpg)](https://itsfoss.com/password-protect-zip-file/)

You are not always restricted to the terminal for creating zip archive files. You can do that graphically as well. Here’s how!

## Zip a folder in Linux Using GUI

📋

Though I have used Ubuntu here, the method should be the same in other distributions using GNOME or other desktop environments.

If you want to compress a file or folder in desktop Linux, it’s just a matter of a few clicks.

Go to the folder where you have the desired files (and folders) you want to compress into one zip folder.

Here, select the files and folders. Now, right-click and select Compress. You can do the same for a single file as well.

![Creating zip file in Ubuntu](https://itsfoss.com/content/images/wordpress/2019/04/create-zip-file-ubuntu-800x428.jpg)

Select the files, right click and click compress

Now you can create a compressed archive file in `zip`, `tar xz` or `7z` format. In case you are wondering, all three are various compression algorithms that you can use for compressing your files.

Give it the name you desire and click on Create.

![Compress a zip folder in Ubuntu](https://itsfoss.com/content/images/wordpress/2019/04/create-zip-folder-ubuntu-1.jpg)

Create archive file

It shouldn’t take long and you should see an archive file in the same directory.

![Zip file created in Ubuntu Linux](https://itsfoss.com/content/images/wordpress/2019/04/zip-file-created-in-ubuntu-800x277.png)

Well, that’s it. You successfully created a zip folder in Linux. The next step is to [learn to unzip a zipped file in the Linux command line](https://itsfoss.com/unzip-linux/).

[How to Unzip Files in Ubuntu & Other Linux \[Terminal & GUI\]This quick tip shows you how to unzip a file in Ubuntu and other Linux distributions. Both terminal and GUI methods have been discussed.![](https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png)It's FOSSAbhishek Prakash![](https://itsfoss.com/content/images/wordpress/2019/10/unzip-file-linux.png)](https://itsfoss.com/unzip-linux/)

I hope this quick little tip helped you with the zip files. Please feel free to share your suggestions.