How to unzip (open) GZ file in ubuntu

March 17, 2021·2 min read
How to unzip (open) GZ file in ubuntu -

Today, we are going to describe how you can unzip or extract any .gz file in Ubuntu (Linux) or MacOs.

Gzip is a popular compression algorithm that reduces the size of a file while keeping the original file mode, ownership, and timestamp. This algorithm is often used to compress web elements for faster page loading.

By convention, a file compressed with gzip ends with either .gz or .z.

This article explains how to open (or unzip) .gz files.

Unzipping gz File :

On Linux and macOS, you can decompress a .gz file using the utility. The syntax is as follows:

To keep the compressed file pass the -k option to the command:

Another command that you can use to decompress a .gz file is This command is basically an alias to file with gzip -d.

To open a .gz file with gunzip simply pass the file name to the command:

f you’re on a desktop environment and the command-line is not your thing, you can use your File manager. To open (unzip) a .gz file, right-click on the file you want to decompress and select "Extract".

Windows users need to install additional software such as 7zip to open .gz files.

Extracting tar.gz File :

Gzip algorithm is designed to compress only a single file. Files that end in .tar.gz are .tar archives compressed with gzip.

To extract a tar.gz file , use tar command with the -xf options followed by the compressed archive name:

tar -xf archive.tar.gz

The command will auto-detect the compression type and will extract the archive in the current working directory .

Short and Sweet

To decompress a .gz file, use the gunzip command followed by the file name.

Happy Coding!

Go back Home.