Gzip is a widely used compression technique and tool for reducing the size of data. In Linux and Unix-based operating distributions, gzip compression is widely popular. The extension of gzip files is usually *.gz or *.z. In this article, we’ll show you how to extract or unzip gzip files using commands like gzip, gunzip, and zcat.
In Linux, there are two methods for unzipping your gz file:
The detailed description of both methods is stated below:
Before unzipping the gz file, you have to compress the file using the gzip command.
Gzip is a widely used compression method that preserves the original file mode, ownership, and date while compressing a file. Gzip also refers to the.gz file format, as well as the gzip tool for compressing and decompressing files.
Use the below-mentioned command to compress a single file:
$ gzip filename |
The gzip creates a file named filename.gz and deletes the original.
By default, in a compressed file, gzip command saves the timestamp, ownership, and name of the original file.
We usually list the file contents, or files and directories, before unzipping or extracting the gz file. To view the list of contents of a gz file, you can use the gzip command. The -l option is available, as seen below:
$ gzip –l test.txt.gz |
To unzip the gz file, you can use the gzip command. Popular Linux distributions such as Ubuntu, Kali, Mint, Fedora, CentOS, and MacOSX, among others, have the gzip command. To unzip gz files, use the -d decompress option. After unzipping, the gz file is erased by default:
$ gzip –d test.txt.gz |
By default, when unzipping a gz file, the gz file is automatically erased. However, we can avoid this by specifying the -k option, which keeps the gz file after decompression.
$ gzip –d –k test.txt.gz |
The gz file can also be unzipped using the gunzip command. Gunzip is the gzip command with various decompression parameters added. However, because we do not need to supply any options, they are easier to know and utilize. The file is unzipped after we enter the gz file name.
$ gunzip test.txt.gz |
The zcat command is a compression command designed for z compression. Other compression techniques, such as gzip and gz files, are also supported. To unzip the gz file, we can use the zcat command. The zcat command is a command that allows you to see what’s.
$ zcat test.txt.gz |
Graphical desktop environments have everything you need if you don’t want to work in a terminal. In Gnome’s Files application, right-click the file that you want to zip and then select the Compress option.
Control-click the directories and/or files you wish to archive and compress, then right-click and choose “Compress.”
The file manager will prompt you to select a format. If you choose .zip, the zipped file will be straightforward to open on any operating system. You can also make advantage of .tar.xz or .7z, but you’ll need the necessary software on your Windows or Mac computer to do it.
Right-click the zipped file in Files again if you need to open it. You can select one of options provided in the drop-down menu. These options are: Open with Archive Manager, Extract Here, and Extract To.
Although the archive manager provides more alternatives, you’ll most likely want to utilize Extract here or Extract to.
This article will provide a fundamental understanding of gz files, their compression, and their decompression methods. This article also covers the two distinct methods for unzipping your gz file under Linux. These methods include command line and graphical user interface (GUI) approaches.
Microsoft Edge is now available for Ubuntu. In this guide, I’ll walk you through the…
Our latest Canonical website rebrand did not just bring the new Vanilla-based frontend, it also…
At Canonical, the work of our teams is strongly embedded in the open source principles…
Welcome to the Ubuntu Weekly Newsletter, Issue 873 for the week of December 29, 2024…
Have WiFi troubles on your Ubuntu 24.04 system? Don’t worry, you’re not alone. WiFi problems…
The following is a post from Mark Shuttleworth on the Ubuntu Discourse instance. For more…