How to unzip (open) GZ file in Ubuntu — codementor.tech
--
For full story or any other technical content please visit : CodeMentor
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:
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 .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 .
Conclusion
To decompress a .gz
file, use the gunzip
command followed by the file name.
You can find more Ubuntu (Linux) related blogs here. If you want to check-out please click HERE.
If you have any questions, please leave a comment below.
Happy Coding!
CodeMentor.
Originally published at http://www.codementor.tech on June 16, 2021.