"How to Unzip a GZ File on Linux: A Step-by-Step Guide"

Christopher Jun 16, 2026

Unzip GZ File in Linux: A Step-by-Step Guide

How to Unzip a Tar.gz File in Linux - Make Tech Easier
How to Unzip a Tar.gz File in Linux - Make Tech Easier

Linux users often encounter compressed files in the GZ format, which require decompression before use. The GZ format is a popular compression algorithm that reduces file size while maintaining data integrity. In this article, we'll explore how to unzip GZ files in Linux, covering various scenarios and tools.

Unzipping Gzip Files on Linux Made Simple
Unzipping Gzip Files on Linux Made Simple

Prerequisites

Before we dive into the process, make sure you have a basic understanding of Linux commands and file systems. Familiarize yourself with the following tools:

How to Extract or Unzip Tar Gz File in Linux - TREND OCEANS
How to Extract or Unzip Tar Gz File in Linux - TREND OCEANS
  • gunzip (for decompressing GZ files)
  • gzip (for compressing files)
  • tar (for working with archives)

Method 1: Using the `gunzip` Command

What Is a GZ File and How Do You Unzip It?
What Is a GZ File and How Do You Unzip It?

The simplest way to unzip a GZ file is by using the `gunzip` command. This command is specifically designed for decompressing GZ files.

Open a terminal and navigate to the directory containing the GZ file. Type the following command:

gunzip file_name.gz

Replace `file_name.gz` with the actual name of your GZ file. The command will automatically decompress the file, and you'll be left with the original file without the `.gz` extension.

How to Unzip or Extract tar.gz Files on Windows
How to Unzip or Extract tar.gz Files on Windows

Method 2: Using `gzip -d` Command

Alternatively, you can use the `gzip -d` command to decompress a GZ file. This method is similar to using `gunzip`, but it uses the `gzip` command with the `-d` option.

Open a terminal and navigate to the directory containing the GZ file. Type the following command:

What Is a GZ File and How Do You Unzip It?
What Is a GZ File and How Do You Unzip It?

gzip -d file_name.gz

Again, replace `file_name.gz` with the actual name of your GZ file. The command will decompress the file, and you'll be left with the original file without the `.gz` extension.

Working with GZ Files in Archives

File Compression and Archiving with zip, gzip, bzip2 and tar : Linux Commands
File Compression and Archiving with zip, gzip, bzip2 and tar : Linux Commands
Download & Unzip Files Without Leaving the Linux Terminal With These 6 Commands
Download & Unzip Files Without Leaving the Linux Terminal With These 6 Commands
Run Windows EXE files on Linux
Run Windows EXE files on Linux
the linux file system is shown in this graphic
the linux file system is shown in this graphic
Linux File System
Linux File System
#cybersecurity #hacking #security
#cybersecurity #hacking #security
noob vs pro
noob vs pro
Linux File System Explained – Complete FHS Directory Guide
Linux File System Explained – Complete FHS Directory Guide
the linux file permissions table
the linux file permissions table
🔗 ln – Create Link to File and Directory in Linux
🔗 ln – Create Link to File and Directory in Linux
Different Linux Distributions Explained (Beginner Guide)🚀
Different Linux Distributions Explained (Beginner Guide)🚀
the linux file system is shown in this diagram
the linux file system is shown in this diagram
Linux File System
Linux File System
the linux file managers wheel is shown with icons in different colors and font on it
the linux file managers wheel is shown with icons in different colors and font on it
Kali Linux Training Program, Linux Cheat Sheet, Linux System Administration Tips, Linux File System Structure, Linux File System Overview, Linux File System, Linux Programming, Understanding Linux File System, Kali Linux Security Features Infographic
Kali Linux Training Program, Linux Cheat Sheet, Linux System Administration Tips, Linux File System Structure, Linux File System Overview, Linux File System, Linux Programming, Understanding Linux File System, Kali Linux Security Features Infographic
the linux file system is shown in this diagram
the linux file system is shown in this diagram
Linux Customization, Kali Linux Commands, Kali Linux, Hacking Books, Data Science Learning, Learn Computer Coding, Secret Websites, Linux Operating System, Linux Kernel
Linux Customization, Kali Linux Commands, Kali Linux, Hacking Books, Data Science Learning, Learn Computer Coding, Secret Websites, Linux Operating System, Linux Kernel
the linux file types poster is shown
the linux file types poster is shown

When working with GZ files within archives, such as tarballs, you'll need to use the `tar` command in conjunction with `gunzip`. Let's say you have a tarball called `archive.tar.gz`. To extract its contents, you can use the following command:

tar -xvzf archive.tar.gz

The `-xvzf` options stand for:

  • -x: Extract the archive
  • -v: Verbose mode ( displays the progress)
  • -z: Unzip the GZ file
  • -f: Specify the file to extract

After running the command, you'll have the extracted files in the current directory.

Troubleshooting Common Issues

If you encounter any issues while decompressing a GZ file, check the following:

  • File permissions: Make sure you have the necessary permissions to read and write files in the target directory.
  • File format: Verify that the file is indeed in the GZ format and not corrupted.
  • Compression level: If the file is highly compressed, it may take longer to decompress.

Conclusion (Not Included)

This article has provided a comprehensive guide to unzipping GZ files in Linux using various methods and tools. With practice, you'll become proficient in working with compressed files and archives in Linux.