How to Unzip a Tar.gz File: A Complete Guide for Every Platform

A .tar.gz file (sometimes written as .tgz) is one of the most common compressed archive formats you'll encounter when working with software packages, Linux distributions, backups, and developer tools. Understanding what it actually is — and the different ways to open it — helps you choose the right approach for your system and comfort level.

What Is a Tar.gz File, Exactly?

The format is actually two operations stacked on top of each other:

  • tar (Tape Archive) bundles multiple files and folders into a single archive file, preserving directory structure and file permissions
  • gzip then compresses that archive to reduce its size

This two-step origin matters because the commands you use reflect both layers. You're not just decompressing — you're also unpacking the bundle inside.

How to Extract a Tar.gz File on Linux and macOS 🖥️

Both Linux and macOS ship with the tar utility built in, making this the most straightforward path for those users.