Gunzip is a versatile command used for extracting and uncompressing gzip (.gz) files. In this guide, we will explore the usage of the gunzip
command and its various options.
Basic Usage
The basic syntax of the gunzip
command is as follows:
gunzip filename.gz
Executing this command will uncompress the filename.gz
file and remove the .gz
extension. The resulting uncompressed file will be saved with the original filename. If a file with the same name already exists, it will be overwritten by the uncompressed file.
Redirecting Output
To extract the compressed file and save it with a different filename, you can use output redirection with the -c
option:
gunzip -c filename.gz > anotherfilename
With this command, the gunzip
command will uncompress the filename.gz
file and the uncompressed content will be redirected to the anotherfilename
file.
Platform Compatibility
The gunzip
command is available on various platforms, including Linux, macOS, and WSL (Windows Subsystem for Linux). It can be used wherever there is a UNIX environment present.
By using the gunzip
command, you can effortlessly extract and uncompress gzip files, making it a valuable tool for handling compressed data.
Tags: gzip, uncompress, extract, command line, Linux, macOS, WSL