---
name: "xzdiff"
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/xzdiff"
---

# xzdiff(1)

compare compressed files

## NAME

xzcmp, xzdiff, lzcmp, lzdiff - compare compressed files

## SYNOPSIS

**xzcmp** \[*option...*\] *file1* \[*file2*\]\
 **xzdiff** ...\
 **lzcmp** ... (DEPRECATED)\
 **lzdiff** ... (DEPRECATED)

## DESCRIPTION

**xzcmp** and **xzdiff** compare uncompressed contents of two files. Uncompressed data and options are passed to [**cmp**(1)](/cmp/1.md) or [**diff**(1)](/diff/1.md) unless **--help** or **--version** is specified.

If both *file1* and *file2* are specified, they can be uncompressed files or files in formats that [**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) can decompress. The required decompression commands are determined from the filename suffixes of *file1* and *file2*. A file with an unknown suffix is assumed to be either uncompressed or in a format that [**xz**(1)](/xz/1.md) can decompress.

If only one filename is provided, *file1* must have a suffix of a supported compression format and the name for *file2* is assumed to be *file1* with the compression format suffix removed.

The commands **lzcmp** and **lzdiff** are provided for backward compatibility with LZMA Utils. They are deprecated and will be removed in a future version.

## EXIT STATUS

If a decompression error occurs, the exit status is **2**. Otherwise the exit status of [**cmp**(1)](/cmp/1.md) or [**diff**(1)](/diff/1.md) is used.

## SEE ALSO

[**cmp**(1)](/cmp/1.md), [**diff**(1)](/diff/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)
