bzdiff
Compare compressed files line by line
SYNOPSIS
bzdiff [-h] [diff_options] left [right]
PARAMETERS
-h, --help
display this help message and exit
[diff_options]
any valid diff(1) options, passed directly (e.g. -u for unified diff, -c for context diff, -r for recursive)
DESCRIPTION
bzdiff is a wrapper script from the bzip2 package designed to compare files compressed with bzip2 without manual decompression. It automatically detects files ending in .bz2, decompresses them to temporary files in /tmp using bzip2 -dc, runs the standard diff command on the uncompressed contents, displays the differences, and cleans up the temporaries. If files lack the .bz2 suffix, it invokes diff directly. This streamlines workflows for developers and sysadmins handling compressed logs, sources, or data. All options except -h are passed verbatim to diff, supporting formats like unified (-u) or context diffs (-c). It's efficient for small-to-medium files but memory and disk-intensive for large ones due to full decompression.
CAVEATS
Requires ample space in /tmp for full decompression of large files.
Fails if /tmp is full or unwritable.
Only auto-decompresses files ending in .bz2; plain files use direct diff.
Not suitable for streaming huge files due to temp file creation.
EXIT STATUS
Same as diff(1): 0 if identical, 1 if different, 2 on error.
EXAMPLES
bzdiff file1.bz2 file2.bz2
bzdiff -u archive1.bz2 archive2.bz2 (unified diff)
HISTORY
Introduced with bzip2 version 1.0 in 1996 by Julian Seward as part of compression utilities suite. Minimal changes since; integrated into major distros like Debian/Ubuntu via bzip2 package.


