gunzip(1)
Decompress files compressed with gzip, restoring them to their original form.
Synopsis
gunzip [OPTION]... [FILE]...Description
gunzip decompresses files that were compressed using the gzip compression program. It replaces each compressed file with an uncompressed version, removing the .gz suffix by default. gunzip can also decompress files with other gzip-compatible suffixes like .z or .tgz.
If no file is specified, gunzip reads from standard input and writes to standard output, making it useful in pipelines. Multiple files can be decompressed in a single command.
Common options
| Flag | What it does |
|---|---|
-c | Write output to standard output; don't modify original files |
-d | Decompress (same as gunzip, included for gzip compatibility) |
-f | Force decompression, overwriting existing files without prompting |
-k | Keep input files; don't remove .gz file after decompression |
-l | List compression ratio and original size for each compressed file |
-n | Don't restore original filename and timestamp from gzip header |
-q | Suppress warning messages |
-r | Recursively decompress all .gz files in directories |
-t | Test integrity of compressed file without decompressing |
-v | Verbose; show name and percentage reduction for each file |
Examples
Decompress file.txt.gz to file.txt, removing the .gz file
gunzip file.txt.gzExtract a tar.gz archive by piping decompressed output to tar
gunzip -c file.tar.gz | tar xDecompress file.gz but keep the original compressed file
gunzip -k file.gzDecompress all .gz files in current directory with verbose output showing compression ratios
gunzip -v *.gzTest the integrity of file.gz without actually decompressing it
gunzip -t file.gzList compression information (size reduction, original size) for all .gz files
gunzip -l *.gzRead gzip-compressed data from stdin and decompress to stdout
zcat file.gz | gunzipRecursively decompress all .gz files in archive/ directory and subdirectories
gunzip -rf archive/