loading...

How To Zip A Folder In Linux Operating System?

How To Zip A Folder In Linux Operating System?

There are several ways to zip and unzip folders in Linux based operating systems. Here I am going to teach you how to zip a folder in Linux operating system. Throughout the blog, we will go through all the ways we can zip a folder in Linux operating system and also we will see how to unzip folders in Linux operating system.

Table of contents –

Zip is a cross-platform file type that compresses all the files in a single zipped folder. This is helpful when you have too many files to be sent on network bandwidth or you want to save the disk space. You can also use zip files when you are migrating all your files from one disk space to another. Using Zip will reduce the time to transfer and also it will ensure that all of your files are transferred.

But you should also know how to unzip these zipped folders. So, in this blog, we will learn how to zip a folder in Linux and then how to unzip it with all the methods. At the end of this blog, you will be able to zip folder in Linux with your convenient method from the listed below.

Installing Zip in Debian based ubuntu system –

Initially one needs to update the apt package repository by using the following command.

$ sudo apt-get update

The above command requires a lot of data, time and space on your Linux system as it will update all the apt-get requirements. You can skip the above step if you are not facing any issues using the below command.

Once apt is updated then install zip and unzip packages using the following command –

$ sudo apt-get install zip unzip –y

Check if you have zip installed on your ubuntu or Linux based operating systems –

The most important step is to check if your operating system is already installed with the zip. Checking for zip installation on your Linux based system is an important step. If the zip is not installed on your Linux operating system then you won’t be able to zip a folder using the below methods.

You can verify if you have zip installed using the following command in your terminal –

sudo apt install zip unzip

How to zip a folder in Linux after you have installed the packages?

Now there are two ways to zip a folder:

  • Graphical method
  • Command-line method

Both the above methods can be used to zip a folder in Linux. The graphical method is simpler if you are not much familiar with using the command-line options on the Linux operating system.

Also read: Do these 6 things right after installing Kali Linux

How to zip a folder in Linux using the Graphical method –

  • Go to the specific folder location on your Linux operating system.
  • Right-click on the folder to be zipped.
  • Select the compress option from the menu.
  • Now you have to enter the name for the zipped file and select “.zip” option
  • The zipped folder is now created in the same directory.

How to Unzip a folder using the Graphical method –

Once the folder zipped and is ready, you can unzip it using the following steps –

  • Right-click on the zipped file
  • Select the Extract here option from the menu

(Use extract here if you want to unzip all the files in the same directory and if you want to unzip all the files in another directory then select “extract to” option and specify the path to the directory)

Also read: Step by Step Guide to Install Windows 10 Using USB


Zip a folder in Linux using the command-line –

The command-line options are equally easy to use but require familiarity with Linux commands and their use. If these commands are not properly used, you may end up deleting the zip folder from your Linux system.  

The following are steps to zip a folder in Linux using the command line method –

Open the directory where the folder is located.

Right-click in the window and open the terminal. Type the following command

$ cd /home/alpha

Here Alpha is the folder to be zipped in the home directory.

The following command is used to zip the folder where Alpha is the name of the final file and output is the directory.

$ zip -r $HOME/Alpha.zip

The folder is now zipped and it can be found by using the ls command.

Also read: Best websites to learn to code and improve skills

Unzip a folder using the command-line –

The following steps can be used to unzip the zip folders using the command line arguments.

Open the directory where the zip folder is available and open the terminal to type the following command.

$ cd Directory_path

Here the Directory_path is the location where the folder is to be extracted.

The following command is used to locate the zipped folder.

$ unzip Alpha.zip

Here Alpha is the zipped folder.

Now the folder is extracted and these are the simple steps used to perform the zipping and unzipping of a folder in Linux.


Frequently Asked Questions –

How do I zip a folder in unix?

Here are the following steps to zip a folder in Linux type OS -

- Go to the specific folder location on your Linux operating system.
- Right-click on the folder to be zipped.
- Select the compress option from the menu.
- Now you have to enter the name for the zipped file and select “.zip” option
- The zipped folder is now created in the same directory.

How do I zip a folder in Linux terminal?

Open the directory where the folder is located.

Right-click in the window and open the terminal. Type the following command

$ cd /home/alpha

Here Alpha is the folder to be zipped in the home directory.

The following command is used to zip the folder where Alpha is the name of the final file and output is the directory.

$ zip -r $HOME/Alpha.zip

The folder is now zipped and it can be found by using the ls command.

How do you unzip a file in Unix?

Once the folder zipped and is ready, you can unzip it using the following steps –

- Right-click on the zipped file
- Select the Extract here option from the menu

(Use extract here if you want to unzip all the files in the same directory and if you want to unzip all the files in another directory then select “extract to” option and specify the path to the directory)


Subscribe to our newsletter and get the latest updates and tips.