1.\" Copyright (c) 1987, 1990 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" This code is derived from software contributed to Berkeley by 5.\" the Institute of Electrical and Electronics Engineers, Inc. 6.\" 7.\" %sccs.include.redist.man% 8.\" 9.\" @(#)cmp.1 6.9 (Berkeley) 08/07/91 10.\" 11.Dd 12.Dt CMP 1 13.Os 14.Sh NAME 15.Nm cmp 16.Nd compare two files 17.Sh SYNOPSIS 18.Nm cmp 19.Op Fl l | Fl s 20.Ar file1 file2 21.Op Ar skip1 Op Ar skip2 22.Sh DESCRIPTION 23The cmp utility compares two files of any type and writes the results 24to the standard output. 25By default, 26.Nm 27is silent if the files are the same; if they differ, the byte 28and line number at which the first difference occurred is reported. 29.Pp 30Bytes and lines are numbered beginning with one. 31.Pp 32The following options are available: 33.Bl -tag -width flag 34.It Fl l 35Print the byte number (decimal) and the differing 36byte values (octal) for each difference. 37.It Fl s 38Print nothing for differing files; return exit 39status only. 40.El 41.Pp 42The optional arguments 43.Ar skip1 44and 45.Ar skip2 46are the byte offsets from the beginning of 47.Ar file1 48and 49.Ar file2 , 50respectively, where the comparison will begin. 51The offset is decimal by default, but may be expressed as an hexadecimal 52or octal value by preceding it with a leading ``0x'' or ``0''. 53.Pp 54The 55.Nm cmp 56utility exits with one of the following values: 57.Bl -tag -width 4n 58.It 0 59The files are identical. 60.It 1 61The files are different; this includes the case 62where one file is identical to the first part of 63the other. 64In the latter case, if the 65.Fl s 66option has not been specified, 67.Nm cmp 68writes to standard output that EOF was reached in the shorter 69file (before any differences were found). 70.It >1 71An error occurred. 72.El 73.Sh SEE ALSO 74.Xr diff 1 , 75.Xr diff3 1 76.Sh STANDARDS 77The 78.Nm cmp 79utility is expected to be 80.St -p1003.2 81compatible. 82