LinuxCommandLibrary

lzcmp

Compare compressed files without decompressing

TLDR

View documentation for the original command

$ tldr xzcmp
copy

SYNOPSIS

lzcmp [OPTION...] FILE1 [FILE2]

PARAMETERS

-h, --help
    display this help and exit

-V, --version
    output version information and exit

CMP_OPTIONS
    all options from cmp(1) accepted (e.g., -l for verbose, -s for silent)

DESCRIPTION

lzcmp is a utility for comparing files compressed with lzop, which uses the fast LZO algorithm. It wraps the cmp command, automatically decompressing files via lzop -dc as needed, without creating temporary decompressed copies. This makes it efficient for large compressed files, saving time and disk space.

Files with .lzo suffixes are treated as compressed; others as plain. If no second file is given, it compares with stdin (decompressed if piped). Differences are reported like cmp, showing byte offsets and values in octal.

Ideal for verifying backups, checking archive integrity, or spotting changes in compressed data. It streams data through pipes, supporting custom cmp options for verbose output, skipping bytes, or silent mode. Requires lzop installed; errors if files aren't valid lzop or corrupt.

CAVEATS

Only handles lzop format; plain files OK but needs valid lzop for compressed. Requires lzop binary. No multi-file or recursive support.

EXAMPLES

lzcmp foo.lzo bar.lzo
Compare two lzop files, report first difference.

lzcmp -l foo.lzo bar.lzo
Verbose: list all differing bytes.

lzcmp -s foo.lzo -
Silent compare with stdin.

EXIT STATUS

0: files equal; 1: different; 2: error (like cmp)

HISTORY

Part of lzop package by Markus F.X.J. Oberhumer, based on LZO library (1996). lzop utilities like lzcmp added ~2002 for streamlined compressed file handling.

SEE ALSO

cmp(1), lzop(1), lzcat(1), zcmp(1)

Copied to clipboard