The gzip command

compress or expand files 4 examples from the lessons of the IVski Linux Playground — try them in the terminal next to them.

Options in the examples

-d --decompress --uncompress
Decompress.
-k --keep
Keep (don't delete) input files during compression or decompression.

Examples

gzip file.txt

Creates file.txt.gz, removes original

gzip -k file.txt

Keep original

gzip -d file.txt.gz

Same as gunzip

sudo gzip largefile.log

Compress instead of deleting, if unsure

Lessons that use gzip