Reference

GZIP (.gz)

GZIP is a fast, single-file compressor that produces .gz files. It compresses one file at a time, so to pack a whole folder it is combined with TAR into a tar.gz. It is the default compression behind much of the web and Unix tooling.

Files & formatsGeneral

GZIP (.gz)

Also known as: .gz file, gunzip, how to open gz, tar.gz

GZIP is a fast, single-file compressor that produces .gz files. It compresses one file at a time, so to pack a whole folder it is combined with TAR into a tar.gz. It is the default compression behind much of the web and Unix tooling.

  • Compresses one file at a time (.gz)
  • Combined with TAR for folders (tar.gz)
  • Fast and lightweight, not the highest ratio

One file at a time

GZIP (the DEFLATE algorithm) shrinks a single file — `report.log` becomes `report.log.gz`. It has no concept of folders, which is why bundling a directory means tarring first, then gzipping the tarball into a tar.gz.

It is prized for being fast with modest CPU use rather than for the tightest ratio. Web servers gzip pages and APIs gzip responses on the fly because speed matters more than squeezing out the last byte.

Opening and the storage angle

Decompress with `gunzip file.gz` or `tar -xf file.tar.gz` on Mac/Linux, or 7-Zip/Keka on desktop. Compress well on text and logs; expect little gain on already-compressed media.

Because gzip replaces or duplicates the original, check the extracted file opens before deleting the .gz so you do not keep both copies longer than needed.

Related terms

Keep reading the reference.