man > xzgrep(1)

⚡ TLDR: xzgrep (tldr-pages)

Search files possibly compressed with `xz`, `lzma`, `gzip`, `bzip2`, `lzop`, or `zstd` using `regex`.

  • Search for a pattern within a file
    xzgrep "{{search_pattern}}" {{path/to/file}}
  • Search for an exact string (disables `regex`)
    xzgrep {{-F|--fixed-strings}} "{{exact_string}}" {{path/to/file}}
  • Search for a pattern in all files showing line numbers of matches
    xzgrep {{-n|--line-number}} "{{search_pattern}}" {{path/to/file}}
  • Print 3 lines of Context around, Before, or After each match
    xzgrep {{-context|--before-context|--after-context}} 3 "{{search_pattern}}" {{path/to/file}}
  • Print file name and line number for each match with color output
    xzgrep {{-H|--with-filename}} {{-n|--line-number}} --color=always "{{search_pattern}}" {{path/to/file}}
  • Search for lines matching a pattern, printing only the matched text
    xzgrep {{-o|--only-matching}} "{{search_pattern}}" {{path/to/file}}
  • Use extended `regex` (supports `?`, `+`, `{}`, `()`, and `|`), in case-insensitive mode
    xzgrep {{-E|--extended-regexp}} {{-i|--ignore-case}} "{{search_pattern}}" {{path/to/file}}
XZGREP(1)                                     XZ Utils                                     XZGREP(1)

NAME
       xzgrep - search compressed files for a regular expression

SYNOPSIS
       xzgrep [grep_options] [-e] pattern [file...]
       xzegrep ...
       xzfgrep ...
       lzgrep ...
       lzegrep ...
       lzfgrep ...

DESCRIPTION
       xzgrep  invokes  grep(1)  on files which may be either uncompressed or compressed with xz(1),
       lzma(1), gzip(1), bzip2(1), lzop(1), or zstd(1).  All options specified are  passed  directly
       to grep(1).

       If no file is specified, then standard input is decompressed if necessary and fed to grep(1).
       When  reading  from  standard input, gzip(1), bzip2(1), lzop(1), and zstd(1) compressed files
       are not supported.

       If xzgrep is invoked as xzegrep or xzfgrep then grep  -E  or  grep  -F  is  used  instead  of
       grep(1).   The  same  applies  to  names lzgrep, lzegrep, and lzfgrep, which are provided for
       backward compatibility with LZMA Utils.

EXIT STATUS
       0      At least one match was found from at least one of the  input  files.   No  errors  oc‐
              curred.

       1      No matches were found from any of the input files.  No errors occurred.

       >1     One or more errors occurred.  It is unknown if matches were found.

ENVIRONMENT
       GREP   If  the  GREP environment variable is set, xzgrep uses it instead of grep(1), grep -E,
              or grep -F.

SEE ALSO
       grep(1), xz(1), gzip(1), bzip2(1), lzop(1), zstd(1), zgrep(1)

Tukaani                                      2022-07-19                                    XZGREP(1)

Generated by phpman v4.12.13 · Markdown · JSON Author: Che Dong Under GNU General Public License
2026-10-21 23:36 @216.73.216.226
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!