Commit | Line | Data |
---|---|---|
b5dc1377 CL |
1 | .\" Copyright (c) 1987, 1990 The Regents of the University of California. |
2 | .\" All rights reserved. | |
d0e4a4f2 | 3 | .\" |
b5dc1377 | 4 | .\" %sccs.include.redist.man% |
85ae1ebc | 5 | .\" |
5325ced3 | 6 | .\" @(#)cmp.1 6.4 (Berkeley) %G% |
b5dc1377 CL |
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 | |
5325ced3 | 16 | .Op Fl l Li \&| Fl s |
b5dc1377 CL |
17 | .Ar file1 file2 |
18 | .Sh DESCRIPTION | |
5325ced3 CL |
19 | The cmp utility compares two files of any type and |
20 | writes the results to the standard output. | |
b5dc1377 | 21 | Under default options, |
5325ced3 CL |
22 | .Nm |
23 | is silent | |
24 | if the files are the same; if they | |
25 | differ, the byte and line | |
26 | number at which the first difference occurred is reported. | |
b5dc1377 CL |
27 | Bytes and |
28 | lines are numbered beginning with one. | |
29 | .Pp | |
30 | The following options are available: | |
5325ced3 | 31 | .Tw Ds |
b5dc1377 CL |
32 | .Tp Fl l |
33 | Print the byte number (decimal) and the differing | |
5325ced3 | 34 | byte values (octal) for each difference, respectively. |
b5dc1377 CL |
35 | .Tp Fl s |
36 | Print nothing for differing files; return exit | |
37 | status only. | |
38 | .Tp | |
39 | .Pp | |
b5dc1377 CL |
40 | The following operands are available: |
41 | .Tw file1 | |
42 | .Tp Ar file1 | |
43 | A pathname of the first file to be compared. | |
44 | If | |
45 | .Ar file1 | |
46 | is | |
5325ced3 | 47 | .Sq Fl , |
b5dc1377 CL |
48 | the standard input is used. |
49 | .Tp Ar file2 | |
50 | A pathname of the second file to be compared. | |
51 | .Tp | |
52 | .Pp | |
b5dc1377 CL |
53 | The |
54 | .Nm cmp | |
55 | utility exits with one of the following values: | |
5325ced3 | 56 | .Tw Ds |
b5dc1377 CL |
57 | .Tp 0 |
58 | The files are identical. | |
59 | .Tp 1 | |
60 | The files are different; this includes the case | |
61 | where one file is identical to the first part of | |
62 | the other. | |
5325ced3 CL |
63 | In the latter case, if the |
64 | .Fl s | |
65 | option has | |
b5dc1377 CL |
66 | not been specified, cmp writes to standard error |
67 | that EOF was reached in the shorter file (before | |
68 | any differences were found). | |
69 | .Tp >1 | |
70 | An error occurred. | |
71 | .Tp | |
72 | .Sh SEE ALSO | |
5325ced3 CL |
73 | .Xr diff 1 , |
74 | .Xr diff3 1 | |
b5dc1377 CL |
75 | .Sh STANDARDS |
76 | The | |
77 | .Nm cmp | |
78 | function is expected to be POSIX 1003.2 compatible. | |
5325ced3 | 79 | This manual page is derived from the POSIX 1003.2 manual page. |