Choosing a Compressor

gzip vs bzip2 vs xz vs zip

They all shrink files, trading speed against ratio (how small).

Tooltar flagSpeedRatioUse when
gzipz⚡ FastGoodThe safe default
bzip2jSlowBetterSpace matters more than time
xzJSlowestBestArchiving big data long-term
zip-FastGoodSharing with Windows users
$ tar -czf a.tar.gz  dir/     # gzip  (z)
$ tar -cJf a.tar.xz  dir/     # xz    (J) - smallest
$ zip -r a.zip dir/           # zip   (cross-platform)
$ unzip a.zip

Standalone (on a single file): gzip filefile.gz, and gunzip file.gz to reverse.

Tip: Rule of thumb: gzip for everyday (fast, universal), xz when you want it as small as possible and don't mind waiting, zip when a Windows user is on the other end.
Analogy: Speed vs ratio is like packing a bag: throw everything in fast (gzip), or fold meticulously so more fits but it takes longer (xz).