Name

gzip — stdin  stdout  - file  -- opt  --help  --version

Synopsis

gzip [options] [files]

gzip and gunzip compress and uncompress files in GNU Zip format. Compressed files have the suffix .gz.

Sample commands

gzip file

Compress file to create file.gz. Original file is deleted.

gzip -c file

Produce compressed data on standard output.

cat file | gzip

Produce compressed data from a pipeline.

gunzip file.gz

Uncompress file.gz to create file. Original file.gz is deleted.

gunzip -c file.gz

Uncompress the data on standard output.

cat file.gz | gunzip

Uncompress the data from a pipeline.

zcat file.gz

Uncompress the data on standard output.

gzipped tar files: sample commands

tar -czf myfile.tar.gz dirname

Pack directory dirname.

tar -tzf myfile.tar.gz

List contents.

tar -xzf myfile.tar.gz

Unpack.

Add the -v option to tar to print filenames as they are processed.

Get Linux Pocket Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.