The gunzip
command is used to decompress files that have been compressed using the gzip
(GNU zip) compression algorithm. It restores the original files from their compressed .gz
format, making them accessible for use.
The basic syntax of the gunzip
command is as follows:
gunzip [options] [arguments]
-c
: Write output to standard output and keep the original files.-f
: Force decompression, even if the target files already exist.-k
: Keep the original compressed files after decompression.-r
: Recursively decompress files in directories.-v
: Verbosely list the files processed.gunzip file.txt.gz
gunzip -k file.txt.gz
gunzip file1.gz file2.gz file3.gz
.gz
files in a directory:
gunzip *.gz
gunzip -c file.txt.gz > file.txt
-k
option if you want to keep the original compressed files for future use.-v
option for verbose output to see which files are being processed, especially when dealing with multiple files..gz
file, you can use gunzip -c filename.gz | less
to view it without decompressing it to disk.