Gunzip or gzip creates files with the suffix of gz, -gz, etc. z, -z, _z or .Z. If you also want a gunzip command tutorial, then read this guide. This guide will help you understand about gunzip commands with examples.
Let’s divide this section into two parts: first part is about compressing the files and the second part is related to decompressing files.
Gunzip Command to Compress a File
For compressing the file, use the following command in the terminal:
$ gunzip <filename>
As you can see in the image above, we have used the command to compress the linuxhintfile.txt.
You can compress multiple files with the command given below:
$ gunzip <filename> <filename1>
If you want to check the information available in the .gz file, then you can execute the following command:
$ gunzip -c <filename>.gz
Here, we typed brackets in the text file so the terminal showed the above result.
You can get information about compressed files using the -l command:
$ gunzip -l <filename>
Gunzip Command to Decompress a File
You can use the simple gunzip command to decompress the file from the terminal:
In case you want to keep both compressed and decompressed files, then you can use -k with the command:
gunzip -k <filename>.gz
If you want to compress or decompress a file forcefully, you can use -f with the gunzip command:
gunzip -f <file-name>
To recursively decompress files using gunzip, use the -r option with the gunzip command:
gunzip -r <filename>.gz
Valuable Tips for Gunzip Command
You can use the -h command to get the complete details about gunzip with its helpful options:
$ gunzip -h
Use -V to get the version number and other information about the gunzip:
$ gunzip -V
You can use the -L option with the command to get software license related information:
$ gunzip -L
In this guide, we have explained everything about gunzip with the correct examples. We have also included all information about both compressing and decompressing the file. This guide will help you complete your task directly from the terminal by downloading no GUI tool into the system.