1cmp(1)                           User Commands                          cmp(1)
2
3
4

NAME

6       cmp - compare two files
7

SYNOPSIS

9       cmp [-l | -s] file1 file2 [skip1] [skip2]
10
11

DESCRIPTION

13       The  cmp  utility compares two files. cmp writes no output if the files
14       are the same. Under default options, if they differ, it writes to stan‐
15       dard  output  the  byte  and line numbers at which the first difference
16       occurred. Bytes and lines are numbered beginning with 1. If one file is
17       an  initial  subsequence  of  the  other, that fact is noted. skip1 and
18       skip2 are initial byte offsets into file1 and file2  respectively,  and
19       can be either octal or decimal. A leading 0 denotes octal.
20

OPTIONS

22       The following options are supported:
23
24       -l    Write  the  byte number (decimal) and the differing bytes (octal)
25             for each difference.
26
27
28       -s    Write nothing for differing files. Return exit status only.
29
30

OPERANDS

32       The following operands are supported:
33
34       file1    A path name of the first file to be compared. If file1  is  ,
35                the standard input is used.
36
37
38       file2    A  path name of the second file to be compared. If file2 is ,
39                the standard input is used.
40
41
42
43       If both file1 and file2 refer to standard input or refer  to  the  same
44       FIFO  special,  block  special  or  character  special  file,  an error
45       results.
46

USAGE

48       See largefile(5) for the  description  of  the  behavior  of  cmp  when
49       encountering files greater than or equal to 2 Gbyte (2^31 bytes).
50

EXAMPLES

52       Example 1 Comparing Files Byte for Byte
53
54
55       The  following  example  does  a  byte for byte comparison of file1 and
56       file2:
57
58
59         example% cmp file1 file2 0 1024
60
61
62
63
64       It skips the first 1024 bytes in file2 before starting the comparison.
65
66

ENVIRONMENT VARIABLES

68       See environ(5) for descriptions of the following environment  variables
69       that  affect the execution of cmp: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
70       and NLSPATH.
71

EXIT STATUS

73       The following error values are returned:
74
75       0     The files are identical.
76
77
78       1     The files are different. This includes the case where one file is
79             identical to the first part of the other.
80
81
82       >1    An error occurred.
83
84

ATTRIBUTES

86       See attributes(5) for descriptions of the following attributes:
87
88
89
90
91       ┌─────────────────────────────┬─────────────────────────────┐
92       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
93       ├─────────────────────────────┼─────────────────────────────┤
94       │Availability                 │SUNWcsu                      │
95       ├─────────────────────────────┼─────────────────────────────┤
96       │CSI                          │Enabled                      │
97       ├─────────────────────────────┼─────────────────────────────┤
98       │Interface Stability          │Standard                     │
99       └─────────────────────────────┴─────────────────────────────┘
100

SEE ALSO

102       comm(1), diff(1), attributes(5), environ(5), largefile(5), standards(5)
103
104
105
106SunOS 5.11                        19 Jul 2006                           cmp(1)
Impressum