8.1 Working With Files
cmp [options] file1 file2 [skip1] [skip2]
The skip numbers are the number of bytes to skip in each file before starting the comparison.
-l report on each difference
-s report exit status only, not byte differences
Given the files mon.logins: and tues.logins:
The comparison of the two files yields:
% cmp mon.logins tues.logins
mon.logins tues.logins differ: char 9, line 2
The default it to report only the first difference found.
This command is useful in determining which version of a file should be kept when there is more than one version.