Penguin
Annotated edit history of diff(1) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 DIFF
2 !!!DIFF
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 SEE ALSO
7 DIAGNOSTICS
8 ----
9 !!NAME
10
11
12 diff - find differences between two files
13 !!SYNOPSIS
14
15
16 __diff__ [[options] from-file to-file
17 !!DESCRIPTION
18
19
20 In the simplest case, ''diff'' compares the contents of
21 the two files ''from-file'' and ''to-file''. A file
22 name of __-__ stands for text read from the standard
23 input. As a special case, __diff - -__ compares a copy of
24 standard input to itself.
25
26
27 If ''from-file'' is a directory and ''to-file'' is
28 not, ''diff'' compares the file in ''from-file'' whose
29 file name is that of ''to-file'', and vice versa. The
30 non-directory file must not be __-__.
31
32
33 If both ''from-file'' and ''to-file'' are directories,
34 ''diff'' compares corresponding files in both
35 directories, in alphabetical order; this comparison is not
36 recursive unless the __-r__ or __--recursive__ option
37 is given. ''diff'' never compares the actual contents of
38 a directory as if it were a file. The file that is fully
39 specified may not be standard input, because standard input
40 is nameless and the notion of ``file with the same name''
41 does not apply.
42
43
44 __diff__ options begin with __-__, so normally
45 ''from-file'' and ''to-file'' may not begin with
46 __-__. However, __--__ as an argument by itself treats
47 the remaining arguments as file names even if they begin
48 with __-__.
49
50
51 __Options__
52
53
54 Below is a summary of all of the options that GNU
55 ''diff'' accepts. Most options have two equivalent names,
56 one of which is a single letter preceded by __-__, and
57 the other of which is a long name preceded by __--__.
58 Multiple single letter options (unless they take an
59 argument) can be combined into a single command line word:
60 __-ac__ is equivalent to __-a -c__. Long named options
61 can be abbreviated to any unique prefix of their name.
62 Brackets (__[[__ and __]__) indicate that an option
63 takes an optional argument.
64
65
66 __-__''lines''
67
68
69 Show ''lines'' (an integer) lines of context. This option
70 does not specify an output format by itself; it has no
71 effect unless it is combined with __-c__ or __-u__.
72 This option is obsolete. For proper operation, ''patch''
73 typically needs at least two lines of context.
74
75
76 __-a__
77
78
79 Treat all files as text and compare them line-by-line, even
80 if they do not seem to be text.
81
82
83 __-b__
84
85
86 Ignore changes in amount of white space.
87
88
89 __-B__
90
91
92 Ignore changes that just insert or delete blank
93 lines.
94
95
96 __--brief__
97
98
99 Report only whether the files differ, not the details of the
100 differences.
101
102
103 __-c__
104
105
106 Use the context output format.
107
108
109 __-C__ ''lines''
110
111
112 __--context[[=__''lines''__]__
113
114
115 Use the context output format, showing ''lines'' (an
116 integer) lines of context, or three if ''lines'' is not
117 given. For proper operation, ''patch'' typically needs at
118 least two lines of context.
119
120
121 __--changed-group-format=__''format''
122
123
124 Use ''format'' to output a line group containing
125 differing lines from both files in if-then-else
126 format.
127
128
129 __-d__
130
131
132 Change the algorithm to perhaps find a smaller set of
133 changes. This makes ''diff'' slower (sometimes much
134 slower).
135
136
137 __-D__ ''name''
138
139
140 Make merged if-then-else format output, conditional on the
141 preprocessor macro ''name''.
142
143
144 __-e__
145
146
147 __--ed__
148
149
150 Make output that is a valid ''ed'' script.
151
152
153 __--exclude=__''pattern''
154
155
156 When comparing directories, ignore files and subdirectories
157 whose basenames match ''pattern''.
158
159
160 __--exclude-from=__''file''
161
162
163 When comparing directories, ignore files and subdirectories
164 whose basenames match any pattern contained in
165 ''file''.
166
167
168 __--expand-tabs__
169
170
171 Expand tabs to spaces in the output, to preserve the
172 alignment of tabs in the input files.
173
174
175 __-f__
176
177
178 Make output that looks vaguely like an ''ed'' script but
179 has changes in the order they appear in the
180 file.
181
182
183 __-F__ ''regexp''
184
185
186 In context and unified format, for each hunk of differences,
187 show some of the last preceding line that matches
188 ''regexp''.
189
190
191 __--forward-ed__
192
193
194 Make output that looks vaguely like an __ed__ script but
195 has changes in the order they appear in the
196 file.
197
198
199 __-h__
200
201
202 This option currently has no effect; it is present for Unix
203 compatibility.
204
205
206 __-H__
207
208
209 Use heuristics to speed handling of large files that have
210 numerous scattered small changes.
211
212
213 __--horizon-lines=__''lines''
214
215
216 Do not discard the last ''lines'' lines of the common
217 prefix and the first ''lines'' lines of the common
218 suffix.
219
220
221 __-i__
222
223
224 Ignore changes in case; consider upper- and lower-case
225 letters equivalent.
226
227
228 __-I__ ''regexp''
229
230
231 Ignore changes that just insert or delete lines that match
232 ''regexp''.
233
234
235 __--ifdef=__''name''
236
237
238 Make merged if-then-else format output, conditional on the
239 preprocessor macro ''name''.
240
241
242 __--ignore-all-space__
243
244
245 Ignore white space when comparing lines.
246
247
248 __--ignore-blank-lines__
249
250
251 Ignore changes that just insert or delete blank
252 lines.
253
254
255 __--ignore-case__
256
257
258 Ignore changes in case; consider upper- and lower-case to be
259 the same.
260
261
262 __--ignore-matching-lines=__''regexp''
263
264
265 Ignore changes that just insert or delete lines that match
266 ''regexp''.
267
268
269 __--ignore-space-change__
270
271
272 Ignore changes in amount of white space.
273
274
275 __--initial-tab__
276
277
278 Output a tab rather than a space before the text of a line
279 in normal or context format. This causes the alignment of
280 tabs in the line to look normal.
281
282
283 __-l__
284
285
286 Pass the output through ''pr'' to paginate
287 it.
288
289
290 __-L__ ''label''
291
292
293 __--label=__''label''
294
295
296 Use ''label'' instead of the file name in the context
297 format and unified format headers.
298
299
300 __--left-column__
301
302
303 Print only the left column of two common lines in side by
304 side format.
305
306
307 __--line-format=__''format''
308
309
310 Use ''format'' to output all input lines in in-then-else
311 format.
312
313
314 __--minimal__
315
316
317 Change the algorithm to perhaps find a smaller set of
318 changes. This makes ''diff'' slower (sometimes much
319 slower).
320
321
322 __-n__
323
324
325 Output RCS-format diffs; like __-f__ except that each
326 command specifies the number of lines affected.
327
328
329 __-N__
330
331
332 __--new-file__
333
334
335 In directory comparison, if a file is found in only one
336 directory, treat it as present but empty in the other
337 directory.
338
339
340 __--new-group-format=__''format''
341
342
343 Use ''format'' to output a group of lines taken from just
344 the second file in if-then-else format.
345
346
347 __--new-line-format=__''format''
348
349
350 Use ''format'' to output a line taken from just the
351 second file in if-then-else format.
352
353
354 __--old-group-format=__''format''
355
356
357 Use ''format'' to output a group of lines taken from just
358 the first file in if-then-else format.
359
360
361 __--old-line-format=__''format''
362
363
364 Use ''format'' to output a line taken from just the first
365 file in if-then-else format.
366
367
368 __-p__
369
370
371 Show which C function each change is in.
372
373
374 __-P__
375
376
377 When comparing directories, if a file appears only in the
378 second directory of the two, treat it as present but empty
379 in the other.
380
381
382 __--paginate__
383
384
385 Pass the output through ''pr'' to paginate
386 it.
387
388
389 __-q__
390
391
392 Report only whether the files differ, not the details of the
393 differences.
394
395
396 __-r__
397
398
399 When comparing directories, recursively compare any
400 subdirectories found.
401
402
403 __--rcs__
404
405
406 Output RCS-format diffs; like __-f__ except that each
407 command specifies the number of lines affected.
408
409
410 __--recursive__
411
412
413 When comparing directories, recursively compare any
414 subdirectories found.
415
416
417 __--report-identical-files__
418
419
420 __-s__
421
422
423 Report when two files are the same.
424
425
426 __-S__ ''file''
427
428
429 When comparing directories, start with the file ''file''.
430 This is used for resuming an aborted
431 comparison.
432
433
434 __--sdiff-merge-assist__
435
436
437 Print extra information to help ''sdiff''. ''sdiff''
438 uses this option when it runs ''diff''. This option is
439 not intended for users to use directly.
440
441
442 __--show-c-function__
443
444
445 Show which C function each change is in.
446
447
448 __--show-function-line=__''regexp''
449
450
451 In context and unified format, for each hunk of differences,
452 show some of the last preceding line that matches
453 ''regexp''.
454
455
456 __--side-by-side__
457
458
459 Use the side by side output format.
460
461
462 __--speed-large-files__
463
464
465 Use heuristics to speed handling of large files that have
466 numerous scattered small changes.
467
468
469 __--starting-file=__''file''
470
471
472 When comparing directories, start with the file ''file''.
473 This is used for resuming an aborted
474 comparison.
475
476
477 __--suppress-common-lines__
478
479
480 Do not print common lines in side by side
481 format.
482
483
484 __-t__
485
486
487 Expand tabs to spaces in the output, to preserve the
488 alignment of tabs in the input files.
489
490
491 __-T__
492
493
494 Output a tab rather than a space before the text of a line
495 in normal or context format. This causes the alignment of
496 tabs in the line to look normal.
497
498
499 __--text__
500
501
502 Treat all files as text and compare them line-by-line, even
503 if they do not appear to be text.
504
505
506 __-u__
507
508
509 Use the unified output format.
510
511
512 __--unchanged-group-format=__''format''
513
514
515 Use ''format'' to output a group of common lines taken
516 from both files in if-then-else format.
517
518
519 __--unchanged-line-format=__''format''
520
521
522 Use ''format'' to output a line common to both files in
523 if-then-else format.
524
525
526 __--unidirectional-new-file__
527
528
529 When comparing directories, if a file appears only in the
530 second directory of the two, treat it as present but empty
531 in the other.
532
533
534 __-U__ ''lines''
535
536
537 __--unified[[=__''lines''__]__
538
539
540 Use the unified output format, showing ''lines'' (an
541 integer) lines of context, or three if ''lines'' is not
542 given. For proper operation, ''patch'' typically needs at
543 least two lines of context.
544
545
546 __-v__
547
548
549 __--version__
550
551
552 Output the version number of ''diff''.
553
554
555 __-w__
556
557
558 Ignore white space when comparing lines.
559
560
561 __-W__ ''columns''
562
563
564 __--width=__''columns''
565
566
567 Use an output width of ''columns'' in side by side
568 format.
569
570
571 __-x__ ''pattern''
572
573
574 When comparing directories, ignore files and subdirectories
575 whose basenames match ''pattern''.
576
577
578 __-X__ ''file''
579
580
581 When comparing directories, ignore files and subdirectories
582 whose basenames match any pattern contained in
583 ''file''.
584
585
586 __-y__
587
588
589 Use the side by side output format.
590 !!SEE ALSO
591
592
593 cmp(1), comm(1), diff3(1), ed(1), patch(1), pr(1),
594 sdiff(1).
595 !!DIAGNOSTICS
596
597
598 An exit status of 0 means no differences were found, 1 means
599 some differences were found, and 2 means
600 trouble.
601 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.