Using Gunzip command-line tool you can decompressing Gzip files. Gzip is the popular compression algorithms to reduce the size of a file and keep the original file mode, ownership, and timestamp. In this tutorial, we will show you how to use the
Decompressing Files with gunzip
Below is the basic syntax for the gunzip command:
gunzip [OPTION]... [FILE]...
gunzip is a bash script wrapper to the gzip -d command in most Linux distributions, such as Ubuntu, CentOS, and Debian.
gzip command line options are applicable
gunzip. You can decompress a
.gz file with
gunzip by passing compressed file name:
It will restore the compressed file to its original name, owner, mode and timestamp.
After decompress, by default,
gunzip will remove the compressed file. You can use the
-k option to keep the file:
gunzip -k filename.gz
-c option to write the output on the terminal.
gunzip -c filename.gz > /directory/path/filename
You can pass the multiple files as arguments with the
gunzip file1.gz file2.gz file3.gz
To recursively decompresses all files in a given directory, use the
gunzip -r directory
List the Compressed File Contents
-l option with
gunzip, to show information about the given compressed files:
gunzip -l filename.gz
In output, it will show the uncompressed file name, the compressed and uncompressed size, and the compression ratio:
compressed uncompressed ratio uncompressed_name 246 282 8.2% filename
For more verbose output, use the
gunzip -lv filename
method crc date time compressed uncompressed ratio uncompressed_name defla 8afa3fs5 Oct 24 11:40 246 282 8.2% filename
The gunzip command is used to decompress
.gz files. To learn more about the
gunzip command, visit the Gnu gzip documentation page.
If you have any questions, please leave a comment below.
Leave a Reply