gunzip
Decompress gzipped files
TLDR
View documentation for the original command
SYNOPSIS
gunzip [options] [file ...]
PARAMETERS
-a, --ascii
Treat input as ASCII text; translate LF to CRLF on output
-c, --stdout, --to-stdout
Write output to stdout, keep original files
-d, --decompress, --uncompress
Explicitly decompress (default behavior)
-f, --force
Force overwrite of existing files without prompting
-h, --help
Display help and exit
-k, --keep
Keep original compressed files after decompression
-l, --list
List compressed file details (size, ratio, etc.)
-L, --license
Display gzip license
-N, --name
Use original filename and timestamp from gzip header
-q, --quiet, --silent
Suppress all warnings
-r
Travel directories recursively (with -N or -k)
-R
Travel all subdirectories recursively
-S suffix, --suffix=suffix
Use specified suffix instead of .gz
-t, --test
Test integrity without decompressing
-v, --verbose
Verbose mode; print filenames and stats
-V, --version
Display version and exit
DESCRIPTION
gunzip is a command-line utility for decompressing files compressed with the gzip algorithm. It is part of the gzip package, which provides lossless compression using a combination of LZ77 and Huffman coding.
By default, gunzip replaces the input file (named file.gz) with the decompressed version (file). It automatically detects the .gz suffix or user-specified suffixes. If the output file exists, it prompts for confirmation before overwriting, unless forced.
It supports processing multiple files, standard input (if no files given), and recursive operation on directories. Output can be directed to stdout for piping. Common uses include extracting archives in scripts, testing compression integrity, and listing compressed file details without decompressing.
gunzip preserves file permissions and timestamps (with -N). It handles concatenated gzip files by decompressing until the first complete member. Errors like corrupted data trigger warnings, but processing continues unless quiet mode is set.
Implemented in portable C, it's available on Unix-like systems, including Linux, and is a de facto standard for .gz files, widely used in web servers (gzip encoding), software distribution, and log rotation.
CAVEATS
Does not decompress non-gzip formats (e.g., .bz2, .xz); assumes .gz suffix by default; may fail silently on corrupted data unless verbose; recursive mode (-r/-R) requires compatible options like -N or -k.
DEFAULT BEHAVIOR
If no files specified, reads from stdin and writes to stdout. Automatically removes .gz extension on decompression.
CONCATENATED FILES
Supports multiple concatenated gzip streams; decompresses until EOF or incomplete member.
HISTORY
Developed by Jean-loup Gailly and Mark Adler in 1992-1993 as part of the gzip program, a free reimplementation of compress with patent-free LZ77+Huffman. gunzip extracted as standalone in early versions. Widely adopted after Unix compress patent expired (1993); now POSIX-standard utility in most Linux distros and BSD.


