1DIFF(1) User Commands DIFF(1)
2
3
4
6 diff - compare files line by line
7
9 diff [OPTION]... FILES
10
12 Compare files line by line.
13
14 -i --ignore-case
15 Ignore case differences in file contents.
16
17 --ignore-file-name-case
18 Ignore case when comparing file names.
19
20 --no-ignore-file-name-case
21 Consider case when comparing file names.
22
23 -E --ignore-tab-expansion
24 Ignore changes due to tab expansion.
25
26 -b --ignore-space-change
27 Ignore changes in the amount of white space.
28
29 -w --ignore-all-space
30 Ignore all white space.
31
32 -B --ignore-blank-lines
33 Ignore changes whose lines are all blank.
34
35 -I RE --ignore-matching-lines=RE
36 Ignore changes whose lines all match RE.
37
38 --strip-trailing-cr
39 Strip trailing carriage return on input.
40
41 -a --text
42 Treat all files as text.
43
44 -c -C NUM --context[=NUM]
45 Output NUM (default 3) lines of copied context.
46
47 -u -U NUM --unified[=NUM]
48 Output NUM (default 3) lines of unified context.
49
50 --label LABEL
51 Use LABEL instead of file name.
52
53 -p --show-c-function
54 Show which C function each change is in.
55
56 -F RE --show-function-line=RE
57 Show the most recent line matching RE.
58
59 -q --brief
60 Output only whether files differ.
61
62 -e --ed
63 Output an ed script.
64
65 --normal
66 Output a normal diff.
67
68 -n --rcs
69 Output an RCS format diff.
70
71 -y --side-by-side
72 Output in two columns.
73
74 -W NUM --width=NUM
75 Output at most NUM (default 130) print columns.
76
77 --left-column
78 Output only the left column of common lines.
79
80 --suppress-common-lines
81 Do not output common lines.
82
83 -D NAME --ifdef=NAME
84 Output merged file to show `#ifdef NAME' diffs.
85
86 --GTYPE-group-format=GFMT
87 Similar, but format GTYPE input groups with GFMT.
88
89 --line-format=LFMT
90 Similar, but format all input lines with LFMT.
91
92 --LTYPE-line-format=LFMT
93 Similar, but format LTYPE input lines with LFMT.
94
95 LTYPE is `old', `new', or `unchanged'.
96 GTYPE is LTYPE or `changed'.
97
98 GFMT may contain:
99
100 %< lines from FILE1
101
102 %> lines from FILE2
103
104 %= lines common to FILE1 and FILE2
105
106 %[-][WIDTH][.[PREC]]{doxX}LETTER
107 printf-style spec for LETTER
108
109 LETTERs are as follows for new group, lower case for old group:
110
111 F first line number
112
113 L last line number
114
115 N number of lines = L-F+1
116
117 E F-1
118
119 M L+1
120
121 LFMT may contain:
122
123 %L contents of line
124
125 %l contents of line, excluding any trailing newline
126
127 %[-][WIDTH][.[PREC]]{doxX}n
128 printf-style spec for input line number
129
130 Either GFMT or LFMT may contain:
131
132 %% %
133
134 %c'C' the single character C
135
136 %c'\OOO'
137 the character with octal code OOO
138
139 -l --paginate
140 Pass the output through `pr' to paginate it.
141
142 -t --expand-tabs
143 Expand tabs to spaces in output.
144
145 -T --initial-tab
146 Make tabs line up by prepending a tab.
147
148 -r --recursive
149 Recursively compare any subdirectories found.
150
151 -N --new-file
152 Treat absent files as empty.
153
154 --unidirectional-new-file
155 Treat absent first files as empty.
156
157 -s --report-identical-files
158 Report when two files are the same.
159
160 -x PAT --exclude=PAT
161 Exclude files that match PAT.
162
163 -X FILE --exclude-from=FILE
164 Exclude files that match any pattern in FILE.
165
166 -S FILE --starting-file=FILE
167 Start with FILE when comparing directories.
168
169 --from-file=FILE1
170 Compare FILE1 to all operands. FILE1 can be a directory.
171
172 --to-file=FILE2
173 Compare all operands to FILE2. FILE2 can be a directory.
174
175 --horizon-lines=NUM
176 Keep NUM lines of the common prefix and suffix.
177
178 -d --minimal
179 Try hard to find a smaller set of changes.
180
181 --speed-large-files
182 Assume large files and many scattered small changes.
183
184 -v --version
185 Output version info.
186
187 --help Output this help.
188
189 FILES are `FILE1 FILE2' or `DIR1 DIR2' or `DIR FILE...' or `FILE...
190 DIR'. If --from-file or --to-file is given, there are no restrictions
191 on FILES. If a FILE is `-', read standard input.
192
194 Written by Paul Eggert, Mike Haertel, David Hayes, Richard Stallman,
195 and Len Tower.
196
198 Report bugs to <bug-gnu-utils@gnu.org>.
199
201 Copyright © 2002 Free Software Foundation, Inc.
202
203 This program comes with NO WARRANTY, to the extent permitted by law.
204 You may redistribute copies of this program under the terms of the GNU
205 General Public License. For more information about these matters, see
206 the file named COPYING.
207
209 The full documentation for diff is maintained as a Texinfo manual. If
210 the info and diff programs are properly installed at your site, the
211 command
212
213 info diff
214
215 should give you access to the complete manual.
216
217
218
219diffutils 2.8.1 November 2010 DIFF(1)