ZGREP(1)
β¨ NAME β¨
zgrep β bestie, it searches compressed files for a regular expression π
π SYNOPSIS π
zgrep [options] <pattern> [files]
π¦ DESCRIPTION π¦
okay so zgrep is literally a front end to the program grep that lets you do a transparent search on any combination of compressed and uncompressed files. no cap. if any file you hand it is compressed, its decompressed content is what gets used. π
if a file you gave doesn't exist, and its name doesn't end with one of the known extensions, zgrep will try the compressed file names corresponding to the formats supported until one is found. and if a file fails to decompress? it does NOT spiral, it just continues searching the rest of the files. queen behavior. π
if a file is specified as -, data are read from standard input, decompressed if needed, and fed to grep. β οΈ important: data read from standard input must be of the same type; all uncompressed or all in the same compressed format. mixing? not the vibe.
if no files are specified, recursive searches examine the current working directory, and nonrecursive searches read standard input.
zgrep --verbose -V prints the version of the grep program used. β¨
the formats supported are bzip2, gzip, lzip, xz, and zstd. iconic lineup fr fr.
heads up bestie: some options only work if the grep program used supports them. π not everything is guaranteed.
πΈ OPTIONS πΈ
-?,--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 π-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-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--verboseβ verbose mode (show error messages)-w,--word-regexpβ match only whole words-x,--line-regexpβ match only whole lines-Z,--nullβ print 0 byte (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. β¨ that's the whole list, memorize it bestie.
π EXIT STATUS π
0if at least one match was found π1if no matches were found π2if trouble π
π REPORTING BUGS π
found a bug? not the vibe, but please tell them: Report bugs to zutils-bug@nongnu.org Zutils home page: http://www.nongnu.org/zutils/zutils.html
π COPYRIGHT π
Copyright Β© 2026 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.
π 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. iykyk π§
k that's the whole page bestie β this is zutils version 1.16, dated February 2026. go forth and grep the compressed files, you absolute icon. ππ¦β¨
π¦ where this page comes from
- ubuntu resolute: zutils 1.16-1 Β· GPL-2.0-or-later
- ubuntu stonking: zutils 1.16-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms