LinuxCommandLibrary

lzdiff

TLDR

View documentation for the original command

$ tldr xzdiff
copy

SYNOPSIS

lzdiff [options] lzfile1 [lzfile2]

PARAMETERS

--help
    display this help and exit

-V, --version
    output version information and exit

[diff options]
    all other options passed directly to diff(1) (see diff(1) manual)

DESCRIPTION

lzdiff is a convenient wrapper around the standard diff(1) command designed specifically for comparing files compressed with lzop, a fast compression utility using the LZO algorithm. Instead of requiring manual decompression of .lzo files—which can be time-consuming and space-intensive—lzdiff automatically decompresses the input files on the fly using lzop -dc and pipes the output directly to diff for comparison.

This makes it ideal for developers, sysadmins, and users managing large compressed archives, logs, or backups where verifying changes without unpacking is essential. If only one filename is provided, lzdiff compares the decompressed content of that file against stdin, allowing seamless integration into pipelines (e.g., cat otherfile | lzdiff compressed.lzo). It preserves all semantic behaviors of diff, reporting insertions, deletions, and modifications in a familiar format.

lzdiff is lightweight, efficient, and requires no temporary files, minimizing disk I/O. It's particularly useful in environments with limited storage or high compression ratios, ensuring quick integrity checks or version comparisons.

CAVEATS

Files must be valid LZOP-compressed (.lzo); non-LZOP files cause errors. Requires lzop installed. Large files may consume significant memory during decompression.

EXAMPLES

lzdiff foo.lzo foo-new.lzo
Compare two compressed files.

lzcmp old.lzo new.lzo (lzcmp often symlinks to lzdiff)

cat uncompressed.txt | lzdiff compressed.lzo
Compare stdin with compressed file.

EXIT STATUS

Exits with diff's status: 0 if identical, 1 if different, 2 on error.

HISTORY

Part of the lzop package, originally developed by Markus F.X.J. Oberhumer in 1996. lzdiff added early in lzop's history (pre-1.0) as a companion tool to utilities like lzgrep. Maintained in lzop 1.04+; widely available on Linux distros via lzop package.

SEE ALSO

diff(1), lzop(1), lzcmp(1), lzgrep(1)

Copied to clipboard