The gunzip
command is used to decompress files that have been compressed using the gzip
(GNU zip) compression algorithm. It restores the original file from its compressed format, making it accessible for use.
The basic syntax of the gunzip
command is as follows:
gunzip [options] [arguments]
-c
: Write output to standard output; do not remove the original files.-f
: Force decompression, even if the file has multiple links or is not a valid gzip file.-k
: Keep the original compressed files after decompression.-q
: Suppress all warnings and error messages.-v
: Verbosely list the files processed.Here are some practical examples of using the gunzip
command:
gunzip file.txt.gz
gunzip file1.gz file2.gz file3.gz
gunzip -k file.txt.gz
gunzip -c file.txt.gz > output.txt
gunzip -f file.txt.gz
-v
option for verbose output to see the progress and details of the decompression process.zcat
as an alternative to gunzip -c
for viewing compressed file contents directly.