1.\" Copyright (c) 1987, 1990 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)cmp.1 6.6 (Berkeley) 06/17/91 7.\" 8.Dd 9.Dt CMP 1 10.Os 11.Sh NAME 12.Nm cmp 13.Nd compare two files 14.Sh SYNOPSIS 15.Nm cmp 16.Op Fl l Li \&| Fl s 17.Ar file1 file2 18.Sh DESCRIPTION 19The cmp utility compares two files of any type and 20writes the results to the standard output. 21By default, 22.Nm 23is silent if the files are the same; if they differ, the byte 24and line number at which the first difference occurred is reported. 25.Pp 26Bytes and lines are numbered beginning with one. 27.Pp 28The following options are available: 29.Bl -tag -width Ds 30.It Fl l 31Print the byte number (decimal) and the differing 32byte values (octal) for each difference. 33.It Fl s 34Print nothing for differing files; return exit 35status only. 36.El 37.Pp 38If 39.Ar file1 40or 41.Ar file2 42is ``-'', the the standard input is used. 43.Pp 44The 45.Nm cmp 46utility exits with one of the following values: 47.Bl -tag -width 4n 48.It 0 49The files are identical. 50.It 1 51The files are different; this includes the case 52where one file is identical to the first part of 53the other. 54In the latter case, if the 55.Fl s 56option has 57not been specified, cmp writes to standard error 58that EOF was reached in the shorter file (before 59any differences were found). 60.It >1 61An error occurred. 62.El 63.Sh SEE ALSO 64.Xr diff 1 , 65.Xr diff3 1 66.Sh STANDARDS 67The 68.Nm cmp 69function is expected to be POSIX 1003.2 compatible. 70