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.
Table of Contents
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
Step 2: Create Simple Text Files
Next, navigate to the “Documents” directory:
cd Documents/
Create a file named “demo.txt” using the below command:
echo “Your tech teacture tutorial” >> demo.txt
Similarly, create another file named “demo2.txt”:
echo “My first zip file tutorial” >> demo2.txt
Step 3: Compress Files in Zip
Now, compress the above-created files in zip format using:
zip demodoc.zip demo.txt demo2.txt
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
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:
Step 2: Compress the File or Folder
Right-click on the file or folder that you want to zip and choose the “Compress” option:
Step 3: Create Zip
Now, set the file name of the archive folder and hit the “Create” button:
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
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:
Then, browse the location to extract the folder and press “Select”:
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.
Software engineer with 3+ years of expertise in Linux, Windows, and multiple programming languages. Proficient in Docker, Kubernetes, and Elasticsearch. Passionate about building scalable systems and helping others through clear, problem-solving guides