How Does File Compression Work?
How does file compression work? Learn the basics of file compression and the difference between lossy versus lossless compression.
Have you gotten a GZ file, and you’re not sure how to open it? This guide will tell you what a GZ file is and how you open it on Windows, Mac, and Linux computers.
It’s fairly easy to view the contents of a GZ file on any of the popular platforms, and there are even multiple ways to do this.
Let’s check them all out.
A GZ file is basically an archive compressed using the gzip compression technology (learn how compression works). Like other file archives, this archive type helps you combine your files and reduce the size of your files by compressing them.
How does file compression work? Learn the basics of file compression and the difference between lossy versus lossless compression.
Like RAR and ZIP, you can open and extract files from a GZ archive using both built-in as well as third-party tools on your computers.
Windows 10 offers various ways to open GZ files. If you prefer commands, you can use the Command Prompt method. In case you’re a graphical user interface person, you can use a free third-party app to access your GZ archives.
Here we cover both methods.
There’s a command called tar that you can use within the Command Prompt to extract your GZ archive contents. This command is built into your operating system, and so you don’t need to install anything to use it.
Related: Windows Command Prompt (CMD) Commands You Must Know
Once you have your GZ file handy with you, use these steps to extract your file’s contents:
tar -xvzf SOURCE -C DESTINATION
If your target folder looks empty even after successfully running the command, that’s probably because you ran the Command Prompt without admin privileges. Open the tool with admin rights, and you should be fine.
There are many free apps on the market to unzip a GZ file on your PC. 7-Zip is a pretty good choice for this task, as it’s easy, free, and open-source.
Here’s how you use this app to decompress GZ archives on your PC:
In macOS, archive types like RAR require you to use an app to decompress your files, but you don’t need to do that for GZ.
You can open GZ files without using any third-party tools on your Mac.
You can either use the Terminal to extract files from a GZ archive or use a built-in macOS tool to decompress your files.
Here are both methods for you.
Like ZIP, you can simply double-click on your GZ archive, and it should start extracting its content. You can do this from any Finder window on your Mac, and your extracted files will be available in a new folder in the same directory as the original GZ archive.
If that doesn’t work for you, make sure you’re opening your GZ file with the built-in unarchiver tool. If you aren’t sure what’s the default archive handler on your Mac, simply right-click on your GZ archive and select Open With > Archive Utility to open the archive with the built-in tool.
Another way to open a GZ archive in macOS is to use a free app called The Unarchiver. This app supports several other formats as well, including ZIP and RAR.
Using the Terminal, you can extract all the files inside your GZ archive using a single command. Your files will be placed in a new folder in the same directory as the original GZ file.
Here’s how you utilize this method:
gunzip -k source.gz
If you’re a Linux user who wants to open a GZ file, you can use a command in the Terminal to extract all the files from your GZ archive.
Gzip is the command that lets you decompress the contents of a GZ archive on your Linux machine.
Here’s how you use this command and start extracting your compressed files:
gzip -dk SOURCE.GZ
tar -xf SOURCE.tar.gz
GZ files have been around for quite a long time. If you’re coming across one for the first time, use one of the methods above to extract the contents from your GZ archive. The above methods work on all the popular platforms, including Windows, Mac, and Linux.
JAR is yet another not-so-common format that you may come across on your computer. Luckily, there are ways to extract files from this file format as well.
Have you ever come across the JAR file type? Here’s what that is and how to open JAR files in Windows 10.
About The Author
Mahesh Makvana
(119 Articles Published)
Mahesh is a tech writer at MakeUseOf. He’s been writing tech how-to guides for about 8 years now and has covered many topics. He loves to teach people how they can get the most out of their devices.
More
From Mahesh Makvana
Join our newsletter for tech tips, reviews, free ebooks, and exclusive deals!
Please confirm your email address in the email we just sent you.