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 ('-' means standard input), and if they differ, tells the first byte and line number where they differ. Bytes and lines are numbered starting with 1. If any given file 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 and xz.

Zcmp compares file1 to file2. If file2 is omitted zcmp tries the following:

1. If file1 is compressed, compares its decompressed contents with the corresponding uncompressed file (the name of file1 with the extension removed).
2. If file1 is uncompressed, compares it with the decompressed contents of file1.[lz|bz2|gz|xz] (the first one that is found).
3. If no suitable file is found, compares file1 with data read from standard input.

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


-h, --help
display this help and exit
-V, --version
output version information and exit
-b, --print-bytes
print differing bytes
-i, --ignore-initial=<n>[:<n2>]
ignore differences in the first <n> bytes
-l, --list
list position, value of all differing bytes
-M, --format=<list>
process only the formats in <list>
-n, --bytes=<n>
compare at most <n> bytes
-N, --no-rcfile
don't read runtime configuration file
-O, --force-format=[<f1>][,<f2>]
force given formats (bz2, gz, lz, xz)
-q, --quiet
suppress all messages
-s, --silent
(same as --quiet)
-v, --verbose
verbose mode (same as --list)
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

Numbers 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 © 2019 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.
January 2019 zcmp (zutils) 1.8