1CMP(1) BSD General Commands Manual CMP(1)
2
4 cmp — compare two files
5
7 cmp [-l | -s] file1 file2 [skip1 [skip2]]
8
10 The cmp utility compares two files of any type and writes the results to
11 the standard output. By default, cmp is silent if the files are the
12 same; if they differ, the byte and line number at which the first differ‐
13 ence occurred is reported.
14
15 Bytes and lines are numbered beginning with one.
16
17 The following options are available:
18
19 -l Print the byte number (decimal) and the differing byte values
20 (octal) for each difference.
21
22 -s Print nothing for differing files; return exit status only.
23
24 The optional arguments skip1 and skip2 are the byte offsets from the
25 beginning of file1 and file2, respectively, where the comparison will
26 begin. The offset is decimal by default, but may be expressed as an
27 hexadecimal or octal value by preceding it with a leading ``0x'' or
28 ``0''.
29
30 The cmp utility exits with one of the following values:
31
32 0 The files are identical.
33
34 1 The files are different; this includes the case where one file is
35 identical to the first part of the other. In the latter case, if
36 the -s option has not been specified, cmp writes to standard output
37 that EOF was reached in the shorter file (before any differences
38 were found).
39
40 >1 An error occurred.
41
43 diff(1), diff3(1)
44
46 The cmp utility is expected to be IEEE Std 1003.2 (“POSIX.2”) compatible.
47
48BSD June 6, 1993 BSD