How to Zip Files in Ubuntu 24.04: Step-by-Step Guide

To efficiently handle the files and folders in the system, you must usually zip the files in Ubuntu 24.04. This also saves the hard disk space and packs the files in an organized way.

This blog demonstrates how to zip the files and folders in Ubuntu 24.04 using multiple methods.

1. Zip Files and Folder in Ubuntu 24.04 From the Command Line

To zip the files and folder in Ubuntu 24.04, check out the listed steps:

Step 1: Install Zip

The zip package is pre-installed in Ubuntu 24.04. If it’s not installed, use:

sudo apt install zip -y
installing zip command on ubuntu 24.04

Step 2: Create Simple Text Files

Next, navigate to the “Documents” directory:

cd Documents/
navigating to documents directory in ubuntu 24.04

Create a file named “demo.txt” using the below command:

echo “Your tech teacture tutorial” >> demo.txt
creating demo.txt file in ubuntu 24.04 using echo command

Similarly, create another file named “demo2.txt”:

echo “My first zip file tutorial” >> demo2.txt
creating demo2.txt file in ubuntu 24.04 using echo command

Step 3:  Compress Files in Zip

Now, compress the above-created files in zip format using:

zip demodoc.zip demo.txt demo2.txt
zipping the files in ubuntu 24.04 using zip command

Note: The above command also assists in compressing a single file instead of multiple files.

Step 4: Compress the Folder in a Zip

To zip the folder in Ubuntu 24.04, use the “zip -r <archive folder name> <folder to be zip>” command:

zip -r demo_folder.zip demofolder
zipping folder in ubuntu 24.04 using zip command

2. Zip Files and Folder in Ubuntu 24.04 From GUI

To zip the folder in Ubuntu 24.04 using its Graphical User Interface (GUI), follow the below steps:

Step 1: Launch Documents Directory

First, open the “Documents” directory from the “Home” directory:

opening the documents folder of ubuntu 24.04

Step 2: Compress the File or Folder

Right-click on the file or folder that you want to zip and choose the “Compress” option:

zipping folder using ubuntu user interface

Step 3: Create Zip

Now, set the file name of the archive folder and hit the “Create” button:

creating zip folder in ubuntu 24.04

Unzip the Files and Folder in Ubuntu 24.04 From the Command Line

To unzip the folder, use the “unzip <archive folder>” command:

unzip demo_folder.zip
unzipping of files or folder in ubuntu 24.04 using unzip command

Unzip the Files and Folder in Ubuntu 24.04 from GUI

To unzip the file or folder from Ubuntu’s graphical interface, simply double-click on the file. The Ubuntu 24.04 will automatically extract the file in the currently opened folder.

To extract the folder on another location, right-click on the archive folder and choose the “Extract to” option:

extracting file or folder in other location

Then, browse the location to extract the folder and press “Select”:

selecting the location to extract the file

This will extract the zip folder on the specified location.

To sum up, zip the file either using the “zip <archive file.zip> <file name>” command or zip the file using the graphical interface of Ubuntu 24.04.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top