gunzip

decompresses files compressed by gzip, zip, compress, or pack

TLDR

Decompress a file
$ gunzip [file.gz]
Decompress keeping original file
$ gunzip -k [file.gz]
Decompress to stdout
$ gunzip -c [file.gz]
Decompress multiple files
$ gunzip [file1.gz] [file2.gz]
Test compressed file integrity
$ gunzip -t [file.gz]
List compression information
$ gunzip -l [file.gz]
Force decompression (ignore warnings)
$ gunzip -f [file.gz]
Verbose output showing compression ratio
$ gunzip -v [file.gz]
Decompress a file with a custom suffix
$ gunzip -S [.zz] [file.zz]
Recursively decompress files in a directory
$ gunzip -r [directory/]

SYNOPSIS

gunzip [options] [files...]

DESCRIPTION

gunzip decompresses files compressed by gzip, zip, compress, or pack. It is equivalent to `gzip -d`. For each compressed file, gunzip creates the uncompressed version and removes the .gz extension.The tool automatically detects the compression format and handles .gz, .z, .Z, and .tgz extensions. Files created by gzip can be recovered even if corrupted, with gunzip replacing damaged blocks with zeros.gunzip preserves the original file's name, timestamp, and permissions stored in the compressed file header.

PARAMETERS

-c, --stdout

Write to stdout, keep original files.
-f, --force
Force decompression even with warnings.
-k, --keep
Keep compressed files.
-l, --list
List compression ratio.
-n, --no-name
Don't restore original name/timestamp.
-N, --name
Restore original name/timestamp (default).
-q, --quiet
Suppress warnings.
-r, --recursive
Recurse into directories.
-t, --test
Test integrity.
-S suffix, --suffix suffix
Use the given suffix instead of .gz.
-v, --verbose
Verbose output showing name and compression ratio.
-1 to -9
Ignored by gunzip; accepted for compatibility with gzip.

INSTALL

sudo apt install gzip
sudo dnf install gzip
sudo pacman -S gzip
sudo apk add gzip
sudo zypper install gzip
brew install gzip
nix profile install nixpkgs#gzip

CAVEATS

Original compressed file is removed by default. Cannot decompress to a different filename directly (use -c and redirection). May fail silently on corrupted files without -v flag.

HISTORY

gunzip is part of the gzip package, created by Jean-loup Gailly and Mark Adler in 1992. It was designed as a free decompressor for gzip files and also handles other compression formats for compatibility. The tool became standard on Unix systems as part of the transition from the patent-encumbered compress utility.

SEE ALSO

gzip(1), zcat(1), compress(1), bunzip2(1), unxz(1)