CMP(1) UNIX Reference Manual CMP(1)
c
\bcm
\bmp
\bp - Compare two files.
S
\bSY
\bYN
\bNO
\bOP
\bPS
\bSI
\bIS
\bS
c
\bcm
\bmp
\bp [-
\b-l
\bl | -
\b-s
\bs] _
\bf_
\bi_
\bl_
\be_
\b1 _
\bf_
\bi_
\bl_
\be_
\b2
D
\bDE
\bES
\bSC
\bCR
\bRI
\bIP
\bPT
\bTI
\bIO
\bON
\bN
The cmp utility compares two files of any type and writes the results to
the standard output. Under default options, c
\bcm
\bmp
\bp is silent if the files
are the same; if they differ, the byte and line number at which the first
difference occurred is reported. Bytes and lines are numbered beginning
The following options are available:
-
\b-l
\bl Print the byte number (decimal) and the differing byte values (oc-
tal) for each difference, respectively.
-
\b-s
\bs Print nothing for differing files; return exit status only.
The following operands are available:
_
\bf_
\bi_
\bl_
\be_
\b1 A pathname of the first file to be compared. If _
\bf_
\bi_
\bl_
\be_
\b1 is `-
\b-',
the standard input is used.
_
\bf_
\bi_
\bl_
\be_
\b2 A pathname of the second file to be compared.
The c
\bcm
\bmp
\bp utility exits with one of 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. In the latter case, if
the -
\b-s
\bs option has not been specified, cmp writes to standard error
that EOF was reached in the shorter file (before any differences
S
\bSE
\bEE
\bE A
\bAL
\bLS
\bSO
\bO
S
\bST
\bTA
\bAN
\bND
\bDA
\bAR
\bRD
\bDS
\bS
The c
\bcm
\bmp
\bp function is expected to be POSIX 1003.2 compatible. This manual
page is derived from the POSIX 1003.2 manual page.