cmp — stdin stdout - file -- opt --help --version
cmp [options
]file1 file2
[offset1
[offset2
]]
The cmp
command compares
two files. If their contents are the same, cmp
reports nothing; otherwise, it lists
the location of the first difference:
$ cmp myfile yourfile myfile yourfile differ: char 494, line 17
By default, cmp
does not
tell you what the difference is, only where it is. It also is
perfectly suitable for comparing binary files, as opposed to
diff
, which operates best on text
files.
Normally, cmp
starts its
comparison at the beginning of each file, but it will start
elsewhere if you provide offsets:
$ cmp myfile yourfile 10 20
This begins the comparison at the tenth character of myfile and the twentieth of yourfile.
18.216.230.107