Quick News Bit

Linux 101: How to create a zip file in Linux

0
7-zip-seciruty-flaw.jpg

CCO Negative Space

When was the last time you had to create a zip file? Personally, I have to interact with those types of files all the time (either receiving or sending them to various clients, family, and friends). For most people, the creation of zip files is second nature. And even on the Linux operating system, working with such files isn’t a challenge… once you know what you’re doing.

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:

sudo apt-get install zip -y

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:

zip filename.zip filename

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).

The right-click context menu in GNOME Files.

Figure 1: The GNOME Files right-click context menu includes the Compress entry.

Image: Jack Wallen

Click Compress, and then, in the resulting window (Figure 2), select .zip from the drop-down and click Create.

The Compress dialoge in GNOME Files.

Figure 2: Creating a zip file from the GNOME Files application.

Image: Jack Wallen

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).

The Extract Here entry in the GNOME Files right-click context menu.

Figure 3: Unzipping a file the GUI way in Linux.

Image: Jack Wallen

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!

For all the latest Technology News Click Here 

 For the latest news and updates, follow us on Google News

Read original article here

Denial of responsibility! NewsBit.us is an automatic aggregator around the global media. All the content are available free on Internet. We have just arranged it in one platform for educational purpose only. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, all materials to their authors. If you are the owner of the content and do not want us to publish your materials on our website, please contact us by email – [email protected]. The content will be deleted within 24 hours.

Leave a comment