Using the Gunzip Command in Linux
What Is the Gunzip Command in Linux?
The gunzip command in Linux is a compression utility designed to extract, or "unzip" files that have been compressed with the gzip algorithm. It is frequently used to reduce the size of files that are downloaded over the Internet. The gunzip command can also be used to decompress files that are split into multiple parts.
How to Use the Gunzip Command
To use the gunzip command, simply type gunzip followed by the name of the compressed file. For example, if you had a file named “example.gz”, you would type gunzip example.gz
. This will extract the file to its original form and create a new file with the same name as the original, but without the “.gz” extension.
If the file has been split into multiple parts, you must first combine the files in order to be able to decompress them. This can be done using the cat command —simply type cat file1 file2 file3 > combinedfile
, where “file1”, “file2”, and “file3” are the respective parts of the split file, and “combinedfile” is the name of the combined version. You can then use the gunzip command on this combined file as usual: gunzip combinedfile
.
Additional Gunzip Options
There are several useful options you can use with the gunzip command. For example, the -l option will list the contents of a gzipped file without actually decompressing it; the -v option will print verbose output; and the -d option will decompress and delete the original gzipped file. For a full list of the options available, simply type man gunzip
in the command line.