LinuxCommandLibrary

xzcmp

Compare xz-compressed files

TLDR

Compare two specific files

$ xzcmp [path/to/file1] [path/to/file2]
copy

SYNOPSIS

xzcmp [cmp options] file1 file2

PARAMETERS

file1
    The first file to compare.
Can be an xz compressed or uncompressed file.

file2
    The second file to compare.
Can be an xz compressed or uncompressed file.

-l
    Output the byte number (decimal) and line number for each difference.
Passed to underlying `cmp` command.

-s
    Output nothing, but return an exit status indicating whether files are identical or not.
Passed to underlying `cmp` command.

--help
    Display help information and exit.

--version
    Display version information and exit.

DESCRIPTION

The xzcmp command is a tool used in Linux and Unix-like operating systems to compare compressed files created using the xz compression algorithm. It essentially decompresses the files in memory and then performs a byte-by-byte comparison. It's similar to the standard cmp command, but it handles xz compressed files directly. This avoids the need to manually decompress files before comparison. If the files are identical, xzcmp reports no differences; otherwise, it indicates the byte and line number where the first difference occurs. It is crucial for verifying that compression and decompression processes haven't altered the data within the files. It is commonly used in scripts and automated processes where file integrity after compression is essential. The xzcmp command is a wrapper for other comparison tools like cmp, diff, and sdiff, applying them to the decompressed data.

EXIT STATUS

The exit status is 0 if the files are identical, 1 if different, or >1 if an error occurred.

SEE ALSO

xz(1), cmp(1), diff(1), zcmp(1), bzcmp(1), gzip(1)

Copied to clipboard