[email protected]Office hours: Mon – Fri 9:00AM – 5:00PMLinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedMarch 15, 2023

How to use Gunzip Command.

How To Use Gunzip Command.

Gunzip is a command-line tool for decompressing Gzip files.

Gzip is one of the most popular compression algorithms that reduce the size of a file and keep the original file mode, ownership, and timestamp.

By convention, files compressed with Gzip are given either the .gz or .z extension.

In this tutorial, we will explain how to use the gunzip command.

 

Decompressing Files with gunzip

The general syntax for the gunzip command is as follows:

gunzip [OPTION]... [FILE]...

On most Linux distributions, such as Ubuntu, CentOS, and Debian, gunzip is a bash script wrapper to the gzip -d command.

All gzip command line options are applicable gunzip.

To decompress a .gz file with gunzip, pass the compressed file name as an argument:

gunzip filename.gz

The command will restore the compressed file to its original name, owner, mode and timestamp.

By default, once decompressed, gunzip will remove the compressed file. Use the -k option to keep the file:

gunzip -k filename.gz

To write the output on the terminal use the -c option. This allows you to keep the compressed file and optionally decompress it to another location:

gunzip -c filename.gz > /directory/path/filename

The gunzip command also accept multiple files as arguments:

gunzip file1.gz file2.gz file3.gz

To recursively decompresses all files in a given directory, use the -r option:

gunzip -r directory

 

List the Compressed File Contents

When used with the -l option, gunzip shows information about the given compressed files:

gunzip -l filename.gz

The output will include the uncompressed file name, the compressed and uncompressed size, and the compression ratio:

         compressed        uncompressed  ratio uncompressed_name
                146                 141   9.2% filename

For more verbose output, use the -v option:

gunzip -lv filename
method  crc     date  time           compressed        uncompressed  ratio uncompressed_name
defla 4a4a3fb5 Aug 29 15:40                 146                 141   9.2% filename

 

Conclusion

The gunzip command allows you to decompress .gz files.

Keep reading
How to Implement Network Segmentation and Resource Isolation in Linux.
February 6, 2024

How to Implement Network Segmentation and Resource Isolation in Linux.

How to Implement Network Segmentation and Resource Isolation in Linux. Securing and managing networks in a Linux environment involves advanced practices like network segmentation and resource isolation. This guide explores these concepts, providing detailed instructions and examples for…

Read article
How to open or close ports in Linux.
February 6, 2024

How to open or close ports in Linux.

How to open or close ports in Linux. Effectively managing ports on your Linux system is crucial for both security and service accessibility. This comprehensive guide will provide a detailed walkthrough on opening and closing ports using the robust tools iptables and ufw. Understanding these…

Read article
How to use ypdomainname command.
January 23, 2024

How to use ypdomainname command.

How to use ypdomainname command. In the realm of Linux networking, the ypdomainname command plays a crucial role in the context of the Network Information Service (NIS). NIS, formerly known as Yellow Pages, is a distributed database service that facilitates the sharing of network configuration and…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, colocation, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Office hours: Mon – Fri 9:00AM – 5:00PM