The gzip command 🤐
gzip compresses files (not directories).
g means GNU)
gzip --best <file-to-compress>
- The original file is NOT preserved.
repetitive-fileis gone. Only the compressed output,
--bestmeans best compression (but slowest to perform).
There is also
--fast. It means fastest to perform (but worst compression).
There are intermediate options:
-1 (--fast), -2, -3, -4, -5, -6 (default), -7, -8, -9 (--best)
I prefer to use
--best in most scenarios. These articles are intended for future Anton’s reference. That’s why I included
--best in this first example.
Others may not consider
--best as the proper default. Use it at your own discretion.
Compressing Files (Preserve Original)
gzip --keep <file-to-compress>
--keep keeps the original file intact during compression, as the name implies.
Compressing Files (Specify Suffix)
gzip --suffix '.myPersonalSuffix' <file-to-compress>
- The compressed file is NOT preserved.
repetitive-file.gzis gone. Only the decompressed output,
- You can also use
gzip --decompress. I just prefer using
Decompressing Files (Preserve Compressed File)
gunzip --keep <file-to-decompress>
You can use the
--keep option with decompression, not just compression.
P.S. If not given files to compress/decompress,
gzip will compress from
STDIN and compress to
Opinions expressed in these articles do not represent those of my employer.