GZIP(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-coption โ 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โ stopsgzipfrom deleting input files after (de)compression. the input files live to see another day ๐-L,--licenseโ prints thegziplicense.-l,--listโ displays info about the file's compressed and uncompressed size, ratio, and uncompressed name. and with the-voption 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 thefts(3)library. one by one, no skipping.-S suffix,--suffix suffixโ changes the default suffix from.gztosuffix. 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 thegzipprogram.-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-loption of thegziputility. so don't come forgzip -lwhen 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
- Copyright (c) 1997, 2003, 2004, 2008, 2009, 2015, 2017 Matthew R. Green
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms