xref: /original-bsd/usr.bin/cmp/cmp.1 (revision 95407d66)
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.4 (Berkeley) 07/24/90
7.\"
8.Dd
9.Dt CMP 1
10.Os BSD 4.4
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.
21Under default options,
22.Nm
23is silent
24if the files are the same; if they
25differ, the byte and line
26number at which the first difference occurred is reported.
27Bytes and
28lines are numbered beginning with one.
29.Pp
30The following options are available:
31.Tw Ds
32.Tp Fl l
33Print the byte number (decimal) and the differing
34byte values (octal) for each difference, respectively.
35.Tp Fl s
36Print nothing for differing files; return exit
37status only.
38.Tp
39.Pp
40The following operands are available:
41.Tw file1
42.Tp Ar file1
43A pathname of the first file to be compared.
44If
45.Ar file1
46is
47.Sq Fl ,
48the standard input is used.
49.Tp Ar file2
50A pathname of the second file to be compared.
51.Tp
52.Pp
53The
54.Nm cmp
55utility exits with one of the following values:
56.Tw Ds
57.Tp 0
58The files are identical.
59.Tp 1
60The files are different; this includes the case
61where one file is identical to the first part of
62the other.
63In the latter case, if the
64.Fl s
65option has
66not been specified, cmp writes to standard error
67that EOF was reached in the shorter file (before
68any differences were found).
69.Tp >1
70An error occurred.
71.Tp
72.Sh SEE ALSO
73.Xr diff 1 ,
74.Xr diff3 1
75.Sh STANDARDS
76The
77.Nm cmp
78function is expected to be POSIX 1003.2 compatible.
79This manual page is derived from the POSIX 1003.2 manual page.
80