How to Unzip (Open) Gz File
2 min read
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)
On Linux and macOS, you can decompress a
.gz file using the
gzip utility. The syntax is as follows:
gzip -d file.gz
The command will restore the compressed file to its original state and remove the
To keep the compressed file pass the
-k option to the command:
gzip -dk file.gz
Another command that you can use to decompress a
.gz file is
gunzip This command is basically an alias to file with
To open a
.gz file with
gunzip simply pass the file name to the command:
If 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
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 .
To decompress a
.gz file, use the
gunzip command followed by the file name.
If you have any questions, please leave a comment below.