Scroll to navigation

ZCMP(1) User Commands ZCMP(1)


zcmp - decompress and compare two files byte by byte


zcmp [options] file1 [file2]


zcmp compares two files and, if they differ, writes to standard output the first byte and line number where they differ. Bytes and lines are numbered starting with 1. A hyphen '-' used as a file argument means standard input. If any file given is compressed, its decompressed content is used. Compressed files are decompressed on the fly; no temporary files are created.

The formats supported are bzip2, gzip, lzip, xz, and zstd.

zcmp compares file1 to file2. The standard input is used only if file1 or file2 refers to standard input. If file2 is omitted zcmp tries to compare file1 with the corresponding uncompressed file (if file1 is compressed), and then with the corresponding compressed files of the remaining formats until one is found.

Exit status is 0 if inputs are identical, 1 if different, 2 if trouble.


display this help and exit
output version information and exit
print differing bytes
print hexadecimal values instead of octal
ignore differences in the first <n> bytes
list position, value of all differing bytes
process only the formats in <list>
compare at most <n> bytes
don't read runtime configuration file
force one or both input formats
suppress diagnostics written to stderr
suppress messages about file differences
verbose mode (opposite of --quiet)
set compressor and options for bzip2 format
set compressor and options for gzip format
set compressor and options for lzip format
set compressor and options for xz format
set compressor and options for zstd format

Valid formats for options '-M' and '-O' are 'bz2', 'gz', 'lz', 'xz', 'zst', and 'un' for uncompressed.

Byte counts given as arguments to options may be expressed in decimal, hexadecimal, or octal (using the same syntax as integer constants in C++), and may be followed by a multiplier: k = kB = 10^3 = 1000, Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc.


Report bugs to
Zutils home page:


Copyright © 2024 Antonio Diaz Diaz. License GPLv2+: GNU GPL version 2 or later <>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.


The full documentation for zcmp is maintained as a Texinfo manual. If the info and zcmp programs are properly installed at your site, the command

info zutils

should give you access to the complete manual.

January 2024 zutils 1.13