cmp [−l|−s] file1 file2
- (Lowercase ell.) Write the byte number (decimal) and the differing bytes (octal) for each difference.
- Write nothing for differing files; return exit status only.
- A pathname of the first file to be compared. If file1 is '−', the standard input shall be used.
- A pathname of the second file to be compared. If file2 is '−', the standard input shall be used.
- Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of POSIX.1‐2008, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.)
- If set to a non-empty string value, override the values of all the other internationalization variables.
- Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments).
- Determine the location of message catalogs for the processing of LC_MESSAGES.
"%s %s differ: char %d, line %d\n", file1, file2, < byte number>, <line number>
"%d %o %o\n", <byte number>, <differing byte>, < differing byte>
"cmp: EOF on %s%s\n", <name of shorter file>, <additional info>
- 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 −l −s ...
cmp −s −l ...