143082Scael.\" Copyright (c) 1987, 1990 The Regents of the University of California. 243082Scael.\" All rights reserved. 319387Smckusick.\" 4*50183Sbostic.\" This code is derived from software contributed to Berkeley by 5*50183Sbostic.\" the Institute of Electrical and Electronics Engineers, Inc. 6*50183Sbostic.\" 743082Scael.\" %sccs.include.redist.man% 832644Sbostic.\" 9*50183Sbostic.\" @(#)cmp.1 6.7 (Berkeley) 06/27/91 1043082Scael.\" 1143082Scael.Dd 1243082Scael.Dt CMP 1 1347399Scael.Os 1443082Scael.Sh NAME 1543082Scael.Nm cmp 1643082Scael.Nd compare two files 1743082Scael.Sh SYNOPSIS 1843082Scael.Nm cmp 1944952Scael.Op Fl l Li \&| Fl s 2043082Scael.Ar file1 file2 2143082Scael.Sh DESCRIPTION 2244952ScaelThe cmp utility compares two files of any type and 2344952Scaelwrites the results to the standard output. 2450070SbosticBy default, 2544952Scael.Nm 2650070Sbosticis silent if the files are the same; if they differ, the byte 2750070Sbosticand line number at which the first difference occurred is reported. 2843082Scael.Pp 2950070SbosticBytes and lines are numbered beginning with one. 3050070Sbostic.Pp 3143082ScaelThe following options are available: 3247399Scael.Bl -tag -width Ds 3347399Scael.It Fl l 3443082ScaelPrint the byte number (decimal) and the differing 3550070Sbosticbyte values (octal) for each difference. 3647399Scael.It Fl s 3743082ScaelPrint nothing for differing files; return exit 3843082Scaelstatus only. 3947399Scael.El 4043082Scael.Pp 4143082ScaelIf 4243082Scael.Ar file1 4350070Sbosticor 4450070Sbostic.Ar file2 4550070Sbosticis ``-'', the the standard input is used. 4643082Scael.Pp 4743082ScaelThe 4843082Scael.Nm cmp 4943082Scaelutility exits with one of the following values: 5047399Scael.Bl -tag -width 4n 5147399Scael.It 0 5243082ScaelThe files are identical. 5347399Scael.It 1 5443082ScaelThe files are different; this includes the case 5543082Scaelwhere one file is identical to the first part of 5643082Scaelthe other. 5744952ScaelIn the latter case, if the 5844952Scael.Fl s 5944952Scaeloption has 6043082Scaelnot been specified, cmp writes to standard error 6143082Scaelthat EOF was reached in the shorter file (before 6243082Scaelany differences were found). 6347399Scael.It >1 6443082ScaelAn error occurred. 6547399Scael.El 6643082Scael.Sh SEE ALSO 6744952Scael.Xr diff 1 , 6844952Scael.Xr diff3 1 6943082Scael.Sh STANDARDS 7043082ScaelThe 7143082Scael.Nm cmp 7243082Scaelfunction is expected to be POSIX 1003.2 compatible. 73