ZGREP(1)
๐
ZGREP(1) โ the zgrep manual page, but make it make sense
okay so this is the <pink>User Commands</pink> manual for zgrep, bestie. it's giving "grep but it can also open the compressed stuff" and honestly? iconic. let's go ๐ซถ
โจ NAME โจ
zgrep โ search compressed files for a regular expression ๐
๐ SYNOPSIS ๐
zgrep [options] <pattern> [files]
that's literally it. that's the whole vibe. [options] go brrr, then your <pattern>, then the [files] you wanna dig through โจ
๐ธ DESCRIPTION ๐ธ
so zgrep is a front end to the program grep that lets you do a transparent search on any combination of compressed and uncompressed files. yes, any combination, she's flexible like that ๐
if any file you give her is compressed, its decompressed content is what gets used. and if a file doesn't exist and its name doesn't end with one of the known extensions, zgrep tries the compressed file names corresponding to the formats supported until one is found. she's out here doing detective work fr fr ๐ต๏ธโโ๏ธ
and if a file fails to decompress? no big deal, she does not spiral. zgrep just continues searching the rest of the files. resilient queen ๐
if a file is specified as -, data are read from standard input, decompressed if needed, and fed to grep. but heads up bestie โ data read from standard input must be of the same type; all uncompressed or all in the same compressed format. no mixing, that's the rule ๐
if no files are specified, recursive searches examine the current working directory, and nonrecursive searches read standard input. iykyk ๐
'zgrep --verbose -V' prints the version of the grep program used. cute, right? ๐
the formats supported are bzip2, gzip, lzip, xz, and zstd. the whole squad ๐
exit status is 0 if match, 1 if no match, 2 if trouble. very demure, very mindful ๐
lowkey important: some options only work if the grep program used supports them. not everything is guaranteed, so don't come for her if a flag ghosts you ๐ญ
๐ OPTIONS ๐
okay this is the big one. buckle up, we're going through all of them, no skipping, periodt ๐
--helpโ display this help and exit ๐ซถ-V,--versionโ output version information and exit โจ-a,--textโ treat all files as text ๐-A,--after-context=<n>โ print<n>lines of trailing context-b,--byte-offsetโ print the byte offset of each line-B,--before-context=<n>โ print<n>lines of leading context-c,--countโ only print a count of matching lines per file ๐ข-C,--context=<n>โ print<n>lines of output context--color[=<when>]โ show matched strings in color ๐ (yes the<when>is optional, she's chill)-e,--regexp=<pattern>โ use<pattern>as the pattern to match-E,--extended-regexpโ<pattern>is an extended regular expression ๐ฅ--exclude=<pattern>โ exclude files matching a shell pattern ๐ โโ๏ธ-f,--file=<file>โ obtain patterns from<file>-F,--fixed-stringsโ<pattern>is a set of newline-separated strings-G,--basic-regexpโ<pattern>is a basic regular expression (default) ๐-h,--no-filenameโ suppress the prefixing file name on output-H,--with-filenameโ print the file name for each match-i,--ignore-caseโ ignore case distinctions, soHelloandhELLoare the same bestie ๐-Iโ ignore binary files ๐ซ-l,--files-with-matchesโ only print names of files containing matches-L,--files-without-matchโ only print names of files containing no matches--label=<label>โ use<label>as file name for standard input ๐ท๏ธ--line-bufferedโ flush output on every line-m,--max-count=<n>โ stop after<n>matches โ-M,--format=<list>โ process only the formats in<list>-n,--line-numberโ print the line number of each line-N,--no-rcfileโ don't read runtime configuration file ๐-o,--only-matchingโ show only the part of a line matching<pattern>-O,--force-format=<fmt>โ force the input format ๐ช-P,--perl-regexpโ<pattern>is a Perl regular expression-q,--quiet,--silentโ suppress all messages ๐คซ-r,--recursiveโ operate recursively on directories ๐-R,--dereference-recursiveโ recursively follow symbolic links ๐-s,--no-messagesโ suppress error messages-T,--initial-tabโ make tabs line up (if needed) ๐-U,--binaryโ don't strip CR characters at EOL (DOS/Windows)-v,--invert-matchโ select non-matching lines, the contrarian icon ๐--verboseโ verbose mode (show error messages) ๐ฃ๏ธ-w,--word-regexpโ match only whole words-x,--line-regexpโ match only whole lines-Z,--nullโ print0byte (ASCII NUL) after file name--bz2=<command>โ set compressor and options for bzip2 format--gz=<command>โ set compressor and options for gzip format--lz=<command>โ set compressor and options for lzip format--xz=<command>โ set compressor and options for xz format--zst=<command>โ set compressor and options for zstd format
valid formats for options '-M' and '-O' are 'bz2', 'gz', 'lz', 'xz', 'zst', and 'un' for uncompressed. write that down bestie ๐
numbers may be followed by a multiplier, and this is genuinely so useful: k = kB = 10^3 = 1000, Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc... math girlies rise ๐งฎโจ
๐ฆ REPORTING BUGS ๐ฆ
found a bug? don't suffer in silence, tell the devs ๐ซถ
- report bugs to
zutils-bug@nongnu.org๐ง - Zutils home page:
http://www.nongnu.org/zutils/zutils.html๐
๐ COPYRIGHT ๐
Copyright ยฉ 2025 Antonio Diaz Diaz. License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html> ๐
this is free software: you are free to change and redistribute it. there is NO WARRANTY, to the extent permitted by law. so like, she's free but she's not gonna fix your life, no cap ๐
๐ SEE ALSO ๐
the full documentation for zgrep is maintained as a Texinfo manual. if the info and zgrep programs are properly installed at your site, the command
info zutils
should give you access to the complete manual. go read it, it's giving lore drop ๐โจ
and that's the whole page, bestie ๐ this was zutils version 1.15, dated May 2025, and it's filed under ZGREP(1) โ mwah, love u, go grep something ๐๐ฆ
๐ฆ where this page comes from
- alpine 3.24: zutils-doc 1.15-r0 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms