That’s exactly what I’m going to help you with today. Together, we’re going to zip and unzip a file on Linux. I’ll show you first how to do it from the command line and then using the GNOME File Manager GUI. Once you’ve gone through this, you’ll be zipping and unzipping files on Linux like a pro.
Requirements
The only thing you’ll need to follow along is a running instance of Linux. I’ll be demonstrating on my go-to distribution, Pop!_OS. How the process of zipping and unzipping files shouldn’t vary from distribution to distribution. The only variation will be how you install the necessary software. With that said, let’s get to the zipping.
Installing Zip
Out of the box, most Linux distributions don’t come with Zip installed. Instead, they default to the tar tool. Fortunately, Zip is really easy to install. Let me show you. Log into your Linux distribution of choice. If that distribution is Debian based (such as Ubuntu, Linux Mint, or Pop!_OS), the installation command is: If you’re on an RHEL-based operating system (such as AlmaLinux, Rocky Linux, or Fedora), that command is: If you’re using an Arch-based Linux distribution, the installation command would be:
Zipping and unzipping a file from the command line
To zip a file (which effectively compresses the file, so its size is considerably smaller) from the command line is actually quite simple… once you know the order of the command, which is: What’s important is the end results (in the above example, filename.zip) comes before the file to be zipped. So, if you have the file zdnet and you want to create the compressed version of that file, the command would be: See how easy it is? To unzip the compressed version, the command would be:
Zipping and unzipping a folder from the command line
This is where it gets a bit tricky. Let’s say you have the folder ZDNET, which contains a bunch of files you want to create into a single, compressed archive. If you just issued the command zip ZDNET.zip ZDNET, you would wind up with a compressed folder with no contents. That’s right; zip would compress the folder but leave out the contents. To retain the contents of the zipped file, you add the -r option (for recursive) like so: The unzipping of a zipped folder is the same as in:
How to zip and unzip a folder from a GUI
If you open the GNOME file manager (this feature is found in most Linux file managers) and right-click a file you want to be zipped, you’ll see a Compress entry (Figure 1). Click Compress, and then, in the resulting window (Figure 2), select .zip from the drop-down and click Create. This will create the new zip file in the current working directory. To unzip a compressed file, right-click it and select Extract Here (Figure 3). And that, my fellow Linux fans, is all there is to zipping and unzipping a file in Linux from both the command line and the GUI. Happy zipping!