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!
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:
unzip <file_name> -d /desired/path
If you need to enter the password, you can just use:
unzip -P <password> <file_name>
When you want to list the files without decompressing them, you just use the -l flag, like this:
unzip -l <file_name>
If you want to test the ,zip file to see if it’s corrupted, you can use the -t flag.
unzip -t <file_name>
Normally, it’ll extract the files and overwrite the existing files (if any). You can avoid that with -n flag:
unzip -n <file_name>
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:
unzip -j <file_name>
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!
Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.