gunzip: Decompress .gz Files in Pipelines
gunzip decompresses .gz files and is exactly equivalent to gzip -d, restoring the original name by stripping the .gz suffix.
gunzip is what you reach for when a cache or artifact arrives as .gz. In CI you usually want -k to keep the archive and -c to pipe straight into tar.
What it does
gunzip reads a .gz file, decompresses it, and writes the original by removing the .gz suffix, deleting the compressed file unless you keep it with -k. It is the same binary behavior as gzip -d.
Common usage
gunzip cache.tar.gz # -> cache.tar, removes .gz
gunzip -k backup.sql.gz # keep backup.sql.gz
gunzip -c data.gz | grep ERROR # stream without writing a file
gunzip -t archive.gz # test integrity onlyOptions
| Flag | What it does |
|---|---|
| -k / --keep | Keep the .gz file after decompressing |
| -c / --stdout | Write output to stdout |
| -t / --test | Test the compressed file integrity |
| -f / --force | Overwrite an existing output file |
| -l / --list | List compressed and uncompressed sizes |
Common errors in CI
"gzip: stdin: not in gzip format" means the input is not gzip; a common cause is a file renamed to .gz that is actually xz or a plain tar. "gzip: <file>: decompression OK, trailing garbage ignored" is usually a concatenated or truncated stream. "unexpected end of file" means the download was truncated; re-fetch the artifact.