How to Zip a Folder in Linux

In this tutorial, we will guide you on how to zip a Folder in Linux. We will teach you two ways in which you can zip a folder in Linux. You can zip a folder through the terminal application or use the compress option available.



Step 1 – Choose the compress option
In Linux, you can zip a folder in order to compress a file. For the purpose of this tutorial, you will see a folder named “TestDir” on our desktop. Let’s right click on the folder over there and a new menu will open up. From the drop down menu, select the compress option.
Click on compress

Step 2 – Configure the compress options
With that done, a new window will open up. Over there you can change the file name, choose the extension of the zipped file and determine the location where the file should be saved.
Choose the extension of the zipped file

Step 3 – Rename the folder
Let’s rename the folder to Test Dir GUI and click on the create button.
Renaming the folder

Step 4 – Zipped file created
With that done, you can see on the desktop that the zip folder has been created.
Creation of Zipped File

Step 5 – Zip via the terminal
Next, we will zip the folder via the terminal application.
Over here, let’s go to the desktop by using the “cd Desktop” command and hitting the enter key once done.
Zipping through the terminal

Step 6 – Use the DIR command
With that done, let’s type “dir” to view the dirctory.
View directory

Step 7 – Command for compression
Now type in:
zip –r TestDirTerminal.zip TestDir”. Once you are done, hit the enter key.
Zipping command

Step 8 – Folder zipped successfully
With that done, the folder will be zipped successfully. In this way in linux, you can zip a folder.
Successful compression