Gunzip Command in Linux Terminal

Gunzip Command in Linux Terminal

In the Linux, Gunzip is a command-line utility that is restore or decompressing Gzip files to their original formate. In this article, we will going to show you how to use the gunzip command in Linux. If you want to learn about gunzip command in Linux then this post is ideal for you.

Linux is an operating system, like Windows OS, iOS, and Mac OS. Linux is one of the most popular operating system on the planet, Android is also powered by Linux OS(operating system).

Decompress files using the Gzip Command

In the Linux, the basic syntax of the Gzip command is show as below:

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

In the most of Linux distributions like Ubuntu, CentOS and Debian gunzip command is a bash script wrapper to the gzip -d command. So all gzip command options are applicable for gunzip.

To decompress a .gz file, simply run the below command :

$ gunzip file_name.gz

When you run the above command, It should restore the compressed Gzip file to its original form.

During decompressing, gunzip command will remove the compressed file. But if you want to keep the file then use the -k option with gunzip command :

$ gunzip -k file_name.gz

Display the output on the terminal 

Use the -c option to display the output on the terminal :

$ gunzip -c file_name.gz

It is also allows you to keep the compressed file and decompress it to another location or directory:

$ gunzip -c filen_ame.gz > /directory/path/file_name

To decompress multiple files

gunzip command also allow you to decompress the multiple files at once:

$ gunzip file_name1.gz file_name2.gz file_name3.gz

To decompresses all Gzip files in a given directory

Use the -r option to recursively decompresses all files in a given directory, :

$ gunzip -r directory

List the Compressed File Contents

With the -l option, gunzip command display more information about a compressed file:

$ gunzip -l file_name.gz

When you run the above command, it will show the following values as output :

  • Compressed value
  • Uncompressed value
  • Ratio of compression
  • Uncompressed name

Use the -v option to more verbose output:

$ gunzip -lv file_name

That’s all

If you face any error and issue in above steps , please use comment box below to report.

If our tutorials helped you, please consider buying us a coffee. We appreciate your support!

Thank you for your support.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top