Cmp (Unix)
Template:Short description
Template:Lowercase title
{{#invoke:Infobox|infobox}}Template:Template other{{#invoke:Check for unknown parameters | check | showblankpositional=1
| unknown = Template:Main other
| preview = Page using Template:Infobox software with unknown parameter "_VALUE_"|ignoreblank=y
| AsOf | author | background | bodystyle | caption | collapsetext | collapsible | developer | discontinued | engine | engines | genre | included with | language | language count | language footnote | latest preview date | latest preview version | latest release date | latest release version | latest_preview_date | latest_preview_version | latest_release_date | latest_release_version | licence | license | logo | logo alt | logo caption | logo upright | logo size | logo title | logo_alt | logo_caption | logo_upright | logo_size | logo_title | middleware | module | name | operating system | operating_system | other_names | platform | programming language | programming_language | released | replaced_by | replaces | repo | screenshot | screenshot alt | screenshot upright | screenshot size | screenshot title | screenshot_alt | screenshot_upright | screenshot_size | screenshot_title | service_name | size | standard | title | ver layout | website | qid
}}Template:Main other
In computing, cmp
is a command-line utility on Unix and Unix-like operating systems that compares two files of any type and writes the results to the standard output. By default, cmp
is silent if the files are the same; if they differ, the byte and line number at which the first difference occurred is reported. The command is also available in the OS-9 shell.<ref>Template:Cite book</ref>
HistoryEdit
<syntaxhighlight lang="text" class="" style="" inline="1">cmp</syntaxhighlight> is part of the X/Open Portability Guide since issue 2 of 1987. It was inherited into the first version of POSIX.1 and the Single Unix Specification.<ref>Template:Man</ref> It first appeared in Version 1 Unix.<ref>Template:Man</ref>
The version of cmp
bundled in GNU coreutils was written by Torbjorn Granlund and David MacKenzie.<ref>{{#invoke:citation/CS1|citation
|CitationClass=web
}}</ref>
The command is available as a separate package for Microsoft Windows as part of the UnxUtils collection of native Win32 ports of common GNU Unix-like utilities.<ref>{{#invoke:citation/CS1|citation
|CitationClass=web
}}</ref> The Template:Mono command has also been ported to the IBM i operating system.<ref>{{#invoke:citation/CS1|citation
|CitationClass=web
}}</ref>
SwitchesEdit
Template:Mono may be qualified by the use of command-line switches. The switches supported by notable implementations of Template:Mono are:
Operands that are byte counts are normally decimal, but may be preceded by 'Template:Mono' for octal and 'Template:Mono' for hexadecimal.
A byte count can be followed by a suffix to specify a multiple of that count; in this case an omitted integer is understood to be 1. A bare size letter, or one followed by 'Template:Mono', specifies a multiple using powers of 1024. A size letter followed by 'Template:Mono' specifies powers of 1000 instead. For example, 'Template:Mono' and 'Template:Mono' are equivalent to 'Template:Mono', whereas 'Template:Mono' is equivalent to 'Template:Mono'. This notation is upward compatible with the SI prefixes<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> for decimal multiples and with the IEC 60027-2 prefixes for binary multiples.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>
ExampleEdit
Return valuesEdit
- 0 – files are identical
- 1 – files differ
- 2 – inaccessible or missing argument
See alsoEdit
ReferencesEdit
External linksEdit
- Template:Man
- Comparing and Merging Files: Invoking cmp The section of the manual of GNU cmp in the diffutils free manual.