XZGREP(1)
β¨ xzgrep β search possibly-compressed files for patterns β¨
okay bestie, listen up π this one's from the XZ Utils fam, it's called xzgrep, and it's literally the moment compressed files stop being a whole thing. no cap.
πΈ SYNOPSIS πΈ
xzgrep [option...] [pattern_list] [file...]
xzegrep ...
xzfgrep ...
lzgrep ... (DEPRECATED)
lzegrep ... (DEPRECATED)
lzfgrep ... (DEPRECATED)
six little names, one iconic job π
π¦ DESCRIPTION π¦
So here's the tea: xzgrep runs grep(1) on the uncompressed contents of your files. how does it know what's what? the filename suffixes, babe β it reads the vibe check off the end of the name. any file with a suffix that xz(1), gzip(1), bzip2(1), lzop(1), zstd(1), or lz4(1) supports gets decompressed on the fly. everything else? assumed to be uncompressed already. slay, no drama. β¨
if you don't name any files, or you pass - as the file, it reads standard input. but heads up β when it's reading from standard input, only files supported by xz(1) get decompressed. the rest are just treated as already-uncompressed content. that's the rules, i don't make them. π
most options from grep(1) are supported, which is giving generous. HOWEVER π the following ones are not supported, so don't come for me:
-r,--recursive-R,--dereference-recursive-d,--directories=action-Z,--null-z,--null-data--include=glob--exclude=glob--exclude-from=file--exclude-dir=glob
write those down, bestie, they will simply not work π
also!! xzegrep is an alias for xzgrep -E, and xzfgrep is an alias for xzgrep -F. same energy, different flag. π«Ά
and the trio lzgrep, lzegrep, and lzfgrep? those exist purely for backward compatibility with LZMA Utils. they are deprecated and will be removed in a future version β so like, use them if you must, but don't get attached. π
β EXIT STATUS β
0β at least one match was found from at least one of the input files, and no errors occurred. we ate. π1β no matches were found from any of the input files, and no errors occurred. it's giving empty search, but at least it was chill about it.>1β one or more errors occurred. and here's the messy part: it is unknown whether matches were found. π
π ENVIRONMENT π
GREPβ if you set this to a non-empty value, that value gets used instead ofgrep,grep -E, orgrep -F. main character energy, honestly. π
π SEE ALSO π
grep(1), xz(1), gzip(1), bzip2(1), lzop(1), zstd(1), lz4(1), zgrep(1)
and that's the whole thing, bestie π brought to you by Tukaani, dated 2025-03-06 β go search something compressed, you've got this π¦πβ¨
π¦ where this page comes from
- alpine 3.22: xz-doc 5.8.4-r0 Β· GPL-2.0-or-later AND 0BSD AND Public-Domain AND LGPL-2.1-or-later
- alpine 3.23: xz-doc 5.8.4-r0 Β· GPL-2.0-or-later AND 0BSD AND Public-Domain AND LGPL-2.1-or-later
- alpine 3.24: xz-doc 5.8.4-r0 Β· GPL-2.0-or-later AND 0BSD AND Public-Domain AND LGPL-2.1-or-later
- arch rolling: xz 5.8.4-1 Β· GPL-2.0-or-later AND 0BSD AND LicenseRef-Public-Domain AND LGPL-2.1-or-later
- nixpkgs unstable: xz 5.8.4
- π the page's license: 0BSD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms