command line utility for Unix or a Unix-like operating systems
The cmp utility shall compare two files. The cmp utility shall write no output if the files are the same. Under default options, if they differ, it shall write to standard output the byte and line number at which the first difference occurred. Bytes and lines shall be numbered beginning with 1. (Lowercase ell.) Write the byte number (decimal) and the differing bytes (octal) for each difference. If both file1 and file2 refer to standard input or refer to the same FIFO special, block special, or character special file, the results are undefined. The standard input shall be used only if the file1 or file2 operand refers to standard input. See the INPUT FILES section. Provide a default value for the internationalization variables that are unset or null. (See XBD 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 that should be used to affect the format and contents of diagnostic messages written to standard error and informative messages written to standard output. [XSI) ] ![[Option Start]]( Determine the location of message catalogs for the processing of LC MESSAGES. ![[Option End]]( for each byte that differs. The first number is from file1 while the second is from file2 . In both cases, shall be relative to the beginning of the file, beginning with 1. The standard error shall be used only for diagnostic messages. If the -l option is used and file1 and file2 differ in length, or if the -s option is not used and file1 and file2 are identical for the entire length of the shorter file, in the POSIX locale the following diagnostic message shall be written: The files are different; this includes the case where one file is identical to the first part of the other. Although input files to cmp can be any type, the results might not be what would be expected on character special device files or on file types not described by the System Interfaces volume of POSIX.1-2017. Since this volume of POSIX.1-2017 does not specify the block size used when doing input, comparisons of character special files need not compare all of the data in those files. For files which are not text files, line numbers simply reflect the presence of a , without any implication that the file is organized into lines. The global language in Utility Description Defaults indicates that using two mutually-exclusive options together produces unspecified results. Some System V implementations consider the option usage: as if no options were specified. Both of these behaviors are considered bugs, but are allowed. The word char in the standard output format comes from historical usage, even though it is actually a byte number. When cmp is supported in other locales, implementations are encouraged to use the word byte or its equivalent in another language. Users should not interpret this difference to indicate that the functionality of the utility changed between locales. Some implementations report on the number of lines in the identical-but-shorter file case. This is allowed by the inclusion of the fields in the output format. The restriction on having a leading and no characters is to make parsing for the filename easier. It is recognized that some filenames containing white-space characters make parsing difficult anyway, but the restriction does aid programs used on systems where the names are predominantly well behaved. Future versions of this standard may require that diagnostic messages are written to standard error when the -s option is specified.
Excerpt from a page describing this subject · 9,991 chars · not written by Vinony
via Wikidata · CC0
via Wikidata sitelinks · CC0
Discovered by embedding cosine similarity (sentence-transformers MiniLM, 384-dim).