---
name: "xzgrep"
section: "1"
platform: "linux"
package: "xz"
version: "5.8.4-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/xzgrep"
---

# xzgrep(1)

search possibly-compressed files for patterns

## NAME

xzgrep - search possibly-compressed files for patterns

## SYNOPSIS

**xzgrep** \[*option...*\] \[*pattern\_list*\] \[*file...*\]\
 **xzegrep** ...\
 **xzfgrep** ...\
 **lzgrep** ... (DEPRECATED)\
 **lzegrep** ... (DEPRECATED)\
 **lzfgrep** ... (DEPRECATED)

## DESCRIPTION

**xzgrep** invokes [**grep**(1)](/grep/1.md) on uncompressed contents of files. The formats of the *files* are determined from the filename suffixes. Any *file* with a suffix supported by [**xz**(1)](/xz/1.md), [**gzip**(1)](/gzip/1.md), [**bzip2**(1)](/bzip2/1.md), [**lzop**(1)](/lzop/1.md), [**zstd**(1)](/zstd/1.md), or [**lz4**(1)](/lz4/1.md) will be decompressed; all other files are assumed to be uncompressed.

If no *files* are specified or *file* is **-** then standard input is read. When reading from standard input, only files supported by [**xz**(1)](/xz/1.md) are decompressed. Other files are assumed to be in uncompressed form already.

Most *options* of [**grep**(1)](/grep/1.md) are supported. However, the following options are not supported:

-

  **-r**, **--recursive**

-

  **-R**, **--dereference-recursive**

-

  **-d**, **--directories=***action*

-

  **-Z**, **--null**

-

  **-z**, **--null-data**

-

  **--include=***glob*

-

  **--exclude=***glob*

-

  **--exclude-from=***file*

-

  **--exclude-dir=***glob*

**xzegrep** is an alias for **xzgrep -E**. **xzfgrep** is an alias for **xzgrep -F**.

The commands **lzgrep**, **lzegrep**, and **lzfgrep** are provided for backward compatibility with LZMA Utils. They are deprecated and will be removed in a future version.

## EXIT STATUS

- 0

  At least one match was found from at least one of the input files. No errors occurred.

- 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 **GREP** is set to a non-empty value, it is used instead of **grep**, **grep -E**, or **grep -F**.

## SEE ALSO

[**grep**(1)](/grep/1.md), [**xz**(1)](/xz/1.md), [**gzip**(1)](/gzip/1.md), [**bzip2**(1)](/bzip2/1.md), [**lzop**(1)](/lzop/1.md), [**zstd**(1)](/zstd/1.md), [**lz4**(1)](/lz4/1.md), [**zgrep**(1)](/zgrep/1.md)
