Today’s article is going to tell you how to unzip a .zip file in the Linux terminal. It shouldn’t be too complex, nor will it take a great deal of time to learn how to unzip a file.
In the Linux world, we don’t really see the .zip files all that often. We have other ways to compress files, but .zip is still there and you’ll sometimes come across them in your travels.
If you’re unaware, the .zip form of data-compression is actually a ratified standard. The format has been around since the late 80s and is one of the compression methods that supports loss-less compression. There are all sorts of compression formats and methods, but .zip has been around since forever and will probably exist long into the future.
If you want to unzip a .zip in a GUI, I’d say that you need look no further than PeaZip. It’s easy enough to compile from source, or you can find pre-built PeaZip packages for most distros. This article, on the other hand, is how to unzip a zip in the Linux terminal.
It’s not all that daunting and should be a pretty easy article for even a beginner to follow. Though, I suppose, any well-written article should be easy enough for a beginner to follow. Were I something other than a basic keyboard smasher, I’d probably be able to do that!
Read: Decompress a .tar.gz in the terminal
Unzip A .zip:
The headline clearly mentions doing this in the terminal, so you’re going to need an open terminal to continue. That’s relatively simple. Just press
With your now-open terminal, let’s first make sure you have the ability to unzip a .zip file. To do that, let’s use:
That should return something akin to:
If you do not get a result, you’ll need to install unzip from your system’s repositories. Trust me, it’s in there – unless you’re using a really, really basic distro.
Assuming you get results indicating that you have unzip, it’s actually easy to unzip a .zip in the Linux terminal. You just navigate to the correct directory and run:
Which, I suppose, is mostly all you’re going to need. I should also mention that when you’re attempting to run this command, you can generally type the first few letters of the file name, and then press
Obviously, there’s more to the unzip command. You can check the
man unzip page, but the more useful flags will get covered here. Seriously, check the man page. The command is absurdly complex, with tons of options for obscure uses.
For example, to unzip a .zip to a different directory, you just use the -d flag, like so:
If you need to enter the password, you can just use:
When you want to list the files without decompressing them, you just use the -l flag, like this:
If you want to test the ,zip file to see if it’s corrupted, you can use the -t flag.
Normally, it’ll extract the files and overwrite the existing files (if any). You can avoid that with -n flag:
When you unzip a .zip, you will find out that it happily creates new directories. You can avoid that with the -j flag, like this:
Do read the man page! There’s a zillion options.
Seriously, read the man page. Learn how to unzip a .zip file – and then all the many, many options included. Of all the man pages out there, this one is one of the most complex ’cause this one little application has a ton of options. Even if you don’t intend to learn it all, read the man page!