maux
Star on GitHub Buy me a coffee

Manual / cmp

cmp(1)

CMP(1) General Commands Manual CMP(1)

cmp - compare two files

cmp [-l|-s] file1 file2

The two files are compared for identical contents. By default, a discrepancy is noted by giving the first differing byte number and line number, both counted from 1. If one file is a prefix of the other, an end-of-file diagnostic is printed.

List every differing byte: decimal position and the two octal byte values.
Suppress ordinary difference reports. Open and usage errors still appear.

The two options are mutually exclusive.

/usr/man/CMP this page

diff(1), comm(1), licenses(1)

Exit status is 0 for identical files, 1 for different files, 2 for a usage or open error.

The byte position and line counters are 24-bit, which is exact for every file maux can open (a file's length is a 3-byte field, at most 16,777,215 bytes).

October 25, 2026 maux