You can just as easily do this in a GUI, but we’ll be using the Linux terminal to unzip .gz files with gunzip. Why? Because we can! You never know when you’ll be limited to a terminal and need to extract the files found in a .gz file.
If you do some searching around the web, you’ll see that .gz files are made with gzip. If you do some more digging, you’ll learn that gzip is both a file type and the name of the application. The .gz files are referred to as gzip files.
While you may encounter just plain .gz files, you’ll often find them as ‘tar.gz’ files, meaning they’ve been prepared for tape archives. You can read about that here:
You won’t need to install anything for this article. The tools will be installed on any major distro – and even on most minor distros. Gzip has been around for more than 30 years, at the time of this writing, and is widely used – even though there are many other compression tools out there. The .gz format is not patent encumbered, nor is it proprietary.
We’ll be using gunzip to unzip .gz files. If you check the man page, you’ll see:
gzip, gunzip, zcat – compress or expand files
As you can see, that means it is the right tool for the job. You can just as easily use ‘file-roller’ in your GUI to unzip .gz files. You have choices!
It’s currently a Sunday evening and my last few articles have been quite long. I think we’ll keep this one short. I might as well…
Unzip .gz Files With gunzip:
As I mentioned earlier, you can do this with a GUI application. We’ll be unzipping .gz files in the terminal. Just press
The first thing you need is a .gz file.
Download example.gz here: Link
With that freshly downloaded, you can use cd to get to your ~/Downloads directory (or whichever directory you used):
Now, you can simply extract the contents, like so:
If you want to extract multiple .gz files at one time, try this:
gunzip example.gz example1.gz, example2.gz
If you want to extract all the .gz files in a folder, try this command:
There you have it. That’s all you need to know if you want to unzip .gz files with gunzip. It’s not even a little complicated. Anyone can figure this one out.
I wasn’t kidding when I said I’d keep this one short. There’s no reason to make it all that long and it’s a weekend. It’s also a holiday weekend and you got a lovely article on Saturday. This one is just a simple task, for those who might want to unzip ..gz files with gunzip – in the Linux terminal. It’s pretty easy!
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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.