compare two files
cmp [ -l ] [ -s ] file1 file2
cmp compares two files. By default, if they are different,
it displays the byte and line number at which the first difference
file1 or file2 is ``-'', standard input
The options are:
cmp understands the -- option delimiter.
Prints the byte number (decimal) and the
differing bytes (octal) for each difference.
Returns an exit code only, 0 for identical files, 1 for different
files, and 2 for inaccessible or missing files.
This command is most useful for comparing binary files. Use
to compare the textual content of text files.
cmp returns the following values:
the files are identical
the files are different: this includes the case where one file is
identical to the first part of the other
an error occurred
cmp is conformant with:
ISO/IEC DIS 99452:1992, Information technology Portable Operating System Interface (POSIX) Part 2: Shell and Utilities (IEEE Std 1003.21992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003