gzip compression
Updated July 3, 2026
gzip compresses a single file, gunzip expands it. tar does not compress on its own, so the pair is joined into .tar.gz.
gzip -k file # compress, -k keeps the original
gunzip file.gz # expand
gzip -t a.tar.gz # check it is valid gzip
gzip -l a.tar.gz # sizes and compression ratiogzip -t checks integrity against the checksum inside the archive. The ratio depends on the data: text compresses well, already-compressed data (images, video) barely at all.
Used in
You need this in the lesson Archives: tar and gzip.