- cmp (Unix)
-
cmp is a command line utility for computer systems that use Unix or a Unix-like operating system. It 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.
Contents
Switches
cmp may be qualified by the use of command-line switches. The switches supported by the GNU version of cmp are:
-b, --print-bytes
- Print differing bytes.
-i SKIP, --ignore-initial=SKIP
- Skip the first SKIP bytes of input.
-i SKIP1:SKIP2, --ignore-initial=SKIP1:SKIP2
- Skip the first SKIP1 bytes of FILE1 and the first SKIP2 bytes of FILE2.
-l, --verbose
- Output byte numbers and values of all differing bytes.
-n LIMIT, --bytes=LIMIT
- Compare at most LIMIT bytes.
-s, --quiet, --silent
- Output nothing; yield exit status only.
-v, --version
- Output version info.
--help
- Outputs a help file.
Return values
- 0 - files are identical
- 1 - files differ
- 2 - inaccessible or missing argument
See also
- Comparison of file comparison tools
- List of Unix programs
References
External links
- The Single UNIX® Specification, Issue 7 from The Open Group : compare two files – Commands & Utilities Reference,
- Comparing and Merging Files: Invoking cmp The section of the manual of GNU cmp in the diffutils free manual.
Unix command-line interface programs and shell builtins (more) File system Processes User environment Text processing Shell builtins Networking Searching Documentation Miscellaneous List of Unix utilities Categories:- Free file comparison tools
- Standard Unix programs
- Unix SUS2008 utilities
Wikimedia Foundation. 2010.