8.1 Working With Files
Syntax
cmp [options] file1 file2 [skip1] [skip2]
The skip numbers are the number of bytes to skip in each file before starting the comparison.
Common Options
-l report on each difference
-s report exit status only, not byte differences
Examples
Given the files mon.logins: and tues.logins:
ageorge ageorge
bsmith cbetts
cbetts jchen
jchen jdoe
jmarsch jmarsch
lkeres lkeres
mschmidt proy
sphillip sphillip
wyepp wyepp
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.