man(1) Manual page archive


     CMP(1)                                                     CMP(1)

     NAME
          cmp - compare two files

     SYNOPSIS
          cmp [ -lsL ] file1 file2 [ offset1 [ offset2 ] ]

     DESCRIPTION
          The two files are compared.  If the contents differ a diag-
          nostic results, otherwise there is no output.

          The options are:

          l    Print the byte number (decimal) and the differing bytes
               (octal) for each difference.

          s    Print nothing for differing files, but set the return
               code.

          L    Print the line number of the first differing byte.

          If offsets are given, comparison starts at the designated
          byte position of the corresponding file.  Offsets that begin
          with 0x are hexadecimal; with 0, octal; with anything else,
          decimal.

     SEE ALSO
          diff(1), comm(1)

     DIAGNOSTICS
          Cmp reports `EOF' and identifies the file if one file is
          short.  It reports the number of the first disagreeing byte
          if contents differ.  The return code is 0 for identical
          files, 1 for different files, and 2 for an inaccessible or
          missing argument.