DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

cmp(C)


cmp -- compare two files

Syntax

cmp [ -l ] [ -s ] file1 file2

Description

cmp compares two files. By default, if they are different, it displays the byte and line number at which the first difference occurred. If file1 or file2 is ``-'', standard input is used.

The options are:


-l
Prints the byte number (decimal) and the differing bytes (octal) for each difference.

-s
Returns an exit code only, 0 for identical files, 1 for different files, and 2 for inaccessible or missing files.
cmp understands the -- option delimiter.

This command is most useful for comparing binary files. Use diff(C) or diff3(C) to compare the textual content of text files.

Exit values

cmp returns the following values:

0
the files are identical

1
the files are different: this includes the case where one file is identical to the first part of the other

>1
an error occurred

See also

comm(C), diff(C), diff3(C)

Standards conformance

cmp is conformant with:

ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.

Notices

A version of cmp that can handle files greater than 2GB is available in /u95/bin. See cmp(1) for more information.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005