GZIP(1)

๐Ÿ“ฆ
version 15.1 ยท 2 versions
, in freebsd 15.1

๐Ÿ’… GZIP(1) โ€” bestie edition โœจ

okay so listen. this is the gzip / gunzip / zcat page from General Commands Manual, and honestly it's giving "small tool, main character energy" ๐ŸŽ€ because it does so much and nobody gives it credit. sit down, grab a strawberry ๐Ÿ“, let's get into it.


๐Ÿ’– NAME ๐Ÿ’–

gzip, gunzip, zcat โ€” the compression/decompression tool that uses Lempel-Ziv coding (LZ77). yes, LZ77. say it with me. it's iconic.


โœจ SYNOPSIS โœจ

gzip [-cdfhkLlNnqrtVv] [-S suffix] file [file [...]]
gunzip [-cfhkLNqrtVv] [-S suffix] file [file [...]]
zcat [-fhV] file [file [...]]

look at that flag soup ๐Ÿ˜ญ every single one of those letters is real and does something, no cap.


๐ŸŒธ DESCRIPTION ๐ŸŒธ

so the gzip program compresses and decompresses files using Lempel-Ziv coding (LZ77). that's the whole vibe.

if you don't specify any files, gzip will compress from standard input, or decompress to standard output. no file? no problem, stdin is right there ๐Ÿซถ

when it's in compression mode, each file gets replaced with another file that has the suffix added to it โ€” and that suffix is set by the -S suffix option, added, if possible.

in decompression mode, each file gets checked for existence, and so does the file with the suffix added. heads up though ๐Ÿ‘‘: each file argument must contain a separate complete archive. when multiple files are indicated, each one is decompressed in turn, one at a time, no bundling.

in the case of gzcat (iykyk), the resulting data is then concatenated in the manner of cat(1). cute lil' bonus behaviour.

if you invoke it as gunzip then the -d option is enabled automatically. and if you invoke it as zcat or gzcat then both the -c and -d options are enabled. it just knows. โœจ

and the flex? this version of gzip is also capable of decompressing files compressed using compress(1), bzip2(1), lzip, zstd(1), or xz(1). it's multilingual bestie, it speaks every compression language ๐Ÿ’…


๐Ÿฆ‹ OPTIONS ๐Ÿฆ‹

the following options are available:

  • -1, --fast โ€” the "just do it fast" setting.
  • -2, -3, -4, -5, -6, -7, -8 โ€” the middle children, each a different level.
  • -9, --best โ€” max effort, max squeeze.

so about all of those ๐Ÿ‘†: these options change the compression level used, with the -1 option being the fastest, with less compression, and the -9 option being the slowest, with optimal compression. the default compression level is 6. (yes, 6. that's the default. remember it.)

  • -c, --stdout, --to-stdout โ€” output goes to the standard output stream, and the files stay intact. nobody gets touched. very respectful. ๐Ÿซถ
  • -d, --decompress, --uncompress โ€” selects decompression rather than compression. the undo button fr.
  • -f, --force โ€” turns on force mode ๐Ÿ’€. this allows: files with multiple links, symbolic links to regular files, overwriting of pre-existing files, reading from or writing to a terminal, and โ€” when combined with the -c option โ€” allowing non-compressed data to pass through unchanged. it's the "i said what i said" flag.
  • -h, --help โ€” prints a usage summary and exits. classic.
  • -k, --keep โ€” stops gzip from deleting input files after (de)compression. the input files live to see another day ๐ŸŒˆ
  • -L, --license โ€” prints the gzip license.
  • -l, --list โ€” displays info about the file's compressed and uncompressed size, ratio, and uncompressed name. and with the -v option it also displays the compression method, CRC, date and time embedded in the file. the receipts, basically ๐Ÿงพ
  • -N, --name โ€” causes the stored filename in the input file to be used as the output file.
  • -n, --no-name โ€” stops the filename and timestamp from being stored in the output file. privacy era ๐Ÿ™ˆ
  • -q, --quiet โ€” no warnings or errors are printed. silence. โœจ
  • -r, --recursive โ€” gzips the files in a directory tree individually, using the fts(3) library. one by one, no skipping.
  • -S suffix, --suffix suffix โ€” changes the default suffix from .gz to suffix. yes you can pick your own, you're the main character ๐Ÿ‘‘
  • -t, --test โ€” tests compressed files for integrity. the vibe check flag, literally.
  • -V, --version โ€” prints the version of the gzip program.
  • -v, --verbose โ€” turns on verbose mode, which prints the compression ratio for each file compressed. numbers! for each file! ๐Ÿ’–

๐Ÿงš ENVIRONMENT ๐Ÿงš

if the environment variable GZIP is set, it is parsed as a white-space separated list of options handled before any options on the command line.

and listen โ€” options on the command line will override anything in GZIP. command line stays winning. periodt. ๐Ÿ‘‘


โญ EXIT STATUS โญ

the gzip utility exits 0 on success, 1 on errors, and 2 if a warning occurs.

three whole numbers, three whole moods.


๐ŸŒˆ SIGNALS ๐ŸŒˆ

gzip responds to the following signals:

๐Ÿ“ก SIGINFO

reports progress to standard error.

that's it. that's the signal. it just wants to tell you how it's doing ๐Ÿ˜ญ๐Ÿซถ


๐Ÿ’œ SEE ALSO ๐Ÿ’œ

bzip2(1), compress(1), xz(1), zstd(1), fts(3), zlib(3)

go read them, they're the extended universe.


๐ŸŽ€ HISTORY ๐ŸŽ€

the gzip program was originally written by Jean-loup Gailly, licensed under the GNU Public Licence. then Matthew R. Green wrote a simple front end for NetBSD 1.3 distribution media, based on the freely re-distributable zlib library. it was later enhanced to be mostly feature-compatible with the original GNU gzip program for NetBSD 2.0. glow-up of the century tbh โœจ

this implementation of gzip was ported based on the NetBSD gzip version 20181111, and first appeared in FreeBSD 7.0.


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

this implementation of gzip was written by Matthew R. Green <mrg@eterna.com.au> with unpack support written by Xin LI <delphij@FreeBSD.org>.

legends. both of them. ๐Ÿซถ


๐Ÿ’€ BUGS ๐Ÿ’€

okay so the one thing you gotta know: according to RFC 1952, the recorded file size is stored in a 32-bit integer, therefore it cannot represent files larger than 4GB.

โš ๏ธ bestie this limitation also applies to the -l option of the gzip utility. so don't come for gzip -l when your file is huge, it literally cannot see it. ๐Ÿ˜ญ

and that's the page!! ๐Ÿ’…โœจ

cute lil' sign-off: this one's from the Debian edition, dated November 2, 2022 โ€” so when you're reading the GZIP(1) man page on your machine, that's the version and date you're looking at. mwah ๐ŸŽ€๐Ÿ’–๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from
  • freebsd 15.1: base 15.1
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms