How to Zip and Unzip files on Ubuntu

Are you a beginner to Linux? In this tutorial, we show you step-by-step methods of creating a zip file and extracting an existing zip file. We shall discuss the command-line as well as the graphical user interface way.

In this article, we shall show you the command-line way and GUI way of creating an archive (zip format) and extracting an existing zip file.

For the tutorial, we are going to use Ubuntu 18.04. If for any reason, the zip is not installed, you can install it using the following command. You also need to install unzip at the same time as, without it, you will not be able to retrieve your files from the zipped content. Typically, both the tools come pre-installed in Ubuntu.

Zip and Unzip by command-line on Ubuntu

Launch the Terminal and enter the following command:

sudo apt install zip unzip

To zip a file using the command line, you need the zip command. The syntax of the command is as below.

zip zipname filename1 filenmae2 filename3 ... filenameN

The parameters include the zip name that you are going to create, followed by the file names.

Let’s see an example to get a better understanding.

zipping
Zipping three files using the zip command

As you can see from the screenshot above. We zip three files — file1, file2, and file3. Once the command is executed, it stores the data into the filename specified. In this case, all three files are zipped into myzip.

You can also zip a folder along with a file name. Let’s see the syntax as below.

zip myzip1 filename1 filename2 folder1 folder2

Now, let’s take a look at the way to zip the files using the Graphical user interface (GUI).

First, you need to move to the folder using your desktop environment or GNOME. In our case, we are going to use GNOME.

Once there, now select the files you want to zip and then right-click on it. There you will find an option of “compress.”

compress-using-gui
Compressing file using GUI

Once you click it, you will see a window, “Create Archive” popup. There, you can choose the filename and then also select the compression algorithm that you want to use to compress the selected file. You have the option to select from zip, tar.xr, and 7z. For simplicity, we are going to use “zip.”

name-gui-compress
Naming the file

It should create your zip named “myfilegui.”

Unzipping

Unzipping files can be done using the unzip command. It is similar to zip command. However, in this case, you only need to put the zip file name as the argument.

The name of the command is as below.

unzip zipname.zip

Let’s try to unzip the files that we zipped in the above section.

unzip-zipname
Unzipping the zip file

We unzipped the files in the same folder, and that’s why it gave you the options to say Yes, No, All, None, and Rename.

But, what happens if you use another format, such as tar? In that case, you need to use the method described in the tar command.

gunzip command lets you work with different formats, including .z, .Z, .taz, .tgz, _z and others. Now, let’s take a look at the uncompressing compressed files using GUI.

As usual, you need to go to the folder where the files are saved. There, you need to right-click the file and click on extract here. If you do so, then it will create a folder similar to the name of the zip file and then extract the contents into there. However, if you choose “Extract to,” then you can select the folder where the extracted files are stored.

extract-files-gui
Extracting files using GUI

Conclusion

It takes us to the end of our guide on how to zip and unzip files in Ubuntu. The command-line route is useful when you want to create an archive or decompress an archive quickly while operating on a remote PC. The GUI way is always accessible from the context menu right-click so that Windows and macOS migraters to Linux feel at home.

Divya Kiran Kumar
I'm the Editor of FOSS Linux. I worked as a Software Engineer before taking up blogging as my full-time job. I enjoy using Linux, and can't imagine anything else for my PC. Apart from writing for FOSS Linux, I enjoy reading non-fictional books. Sapiens was my favorite last read. I hope you enjoy reading and using this blog to enhance your Linux experience! Have a great day ahead!

1 COMMENT

  1. Very good and clear. However, my installation is still on 3.04 whilst there is 5.0.x available. How do i upgrade??

LEAVE A REPLY

Please enter your comment!
Please enter your name here

STAY CONNECTED

23,419FansLike
377FollowersFollow
16SubscribersSubscribe

LATEST ARTICLES

Basics of Working with the SQLite Database in Python

A database is one of the most useful and popular files for storing data; they can be used to store any kind of data, including text, numbers, images, binary data, files, etc. SQLite is a relational database management system based on the SQL language. It is a C library, and it provides an API to work with other programming languages, including Python. It does not require a separate server process to be run as needed in large database engines like MySQL and Postgresql.

5 Ways to Check the Linux Version

When most people talk of Linux, they are always referring to a Linux distribution. However, this is not the case. Linux itself is a kernel which acts as a bridge between user applications and the hardware. When we talk of a Linux distribution, we refer to an operating system developed from the Linux kernel. A distribution comes with a package manager, pre-installed applications, a Desktop Environment, and several more features.

Getting Started with Linux Operating System

The Linux operating system brings forth a vibrant mix of features and security, making it the best alternative to macOS or Windows operating systems. In this post, we will give you a master guide on Getting started with Linux systems - taking you from a complete beginner to a level where you can begin testing the various Linux distributions available with much ease.

How to Create a Comprehensive Mail Server on Ubuntu

Postal is a free and open-source mail server used to send and receive emails. It comes loaded with tons of excellent features and functionalities, making it extremely popular among large organizations as well as in enterprise settings.

The 10 Best Linux Performance Monitoring Tools

Do you want to monitor the performance of your Linux system? Are you looking for some powerful performance monitoring tools to help you out? If you agree, it's your day as we have put together a detailed list of the ten best Linux performance monitoring tools.

How to Boot your Windows or Linux PC from a USB Drive

Sometime back, the process of installing an operating system required users to pop a bootable media disk into their DVD or CD drive and use it to boot the PC. But times have changed. Nowadays, the most common way of installing an OS is booting from a USB drive. The use of USB drives is further propelled by the current production of slim and lightweight laptops with no support for DVD/CD drives.

MUST READ

Buyers who wish to go for a machine that is based on Linux often show interest in Chromebooks due to the form factor and extended battery life capabilities. Although ChromeOS power these machines, users can still miss out on a more genuine Linux experience. For those who happen to agree, the new Lemur Pro by System76 might get some heads turning.
Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.

How to dual-boot Ubuntu and Fedora on your PC

Every Linux distribution has its capabilities and preferences as per the user requirements. That brings forth the need to run different distros on one laptop. For example, a CyberSecurity enthusiast might prefer to use Ubuntu for development and Kali Linux for penetration testing.

VIDEO: MX Linux 19 Features and Desktop Tour

MX Linux is a Linux distribution based on Debian stable and using core antiX components. The distributions MX Tools is very popular among users and combined with other several ready-to-use tools, it is great for users who prefer to tweak their distro to their liking. In this video, we will take you through the features tour showing casing MX Linux 19.

10 Best PDF Editors for Linux

In this article, we will take a look at 10 of the best PDF editors and tools out there in 2019 that are available for Linux platforms. The editors are going to be judged on the basis of their functionalities, portability, ease of installation, price, and convenience.

Pop!_OS 20.04 Review: Professional Linux Distribution Ever Made

Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.