How to Unzip a GZ File in Linux: Commands, Options, and What to Know First

If you've downloaded a .gz file on Linux and aren't sure what to do with it, you're not alone. GZ files are one of the most common compressed formats on Linux systems, and unpacking them is a core skill — whether you're extracting source code, log files, database backups, or software packages.

What Is a GZ File?

A .gz file is a compressed archive created using GNU Zip (gzip) compression. Gzip is a lossless compression algorithm, meaning no data is lost when you compress or decompress a file. It's widely used on Linux and Unix-based systems because it's fast, efficient, and built into virtually every distribution.

One important distinction: a .gz file typically compresses a single file. If someone bundled multiple files together first, they likely used tar before gzip — producing a .tar.gz (or .tgz) file. These two cases require slightly different commands, which is where most confusion begins.

The Basic Command: gunzip

The simplest way to decompress a .gz file is with the gunzip command: