summaryrefslogtreecommitdiff
path: root/man/diff.1
blob: c32cbd8611710cb2757e7b86348d52490cd8ac36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.40.4.
.TH DIFF "1" "May 2023" "diffutils 3.10" "User Commands"
.SH NAME
diff \- compare files line by line
.SH SYNOPSIS
.B diff
[\fIOPTION\fR]... \fIFILES\fR
.SH DESCRIPTION
Compare FILES line by line.
.PP
Mandatory arguments to long options are mandatory for short options too.
.TP
\fB\-\-normal\fR
output a normal diff (the default)
.TP
\fB\-q\fR, \fB\-\-brief\fR
report only when files differ
.TP
\fB\-s\fR, \fB\-\-report\-identical\-files\fR
report when two files are the same
.TP
\fB\-c\fR, \fB\-C\fR NUM, \fB\-\-context\fR[=\fINUM\fR]
output NUM (default 3) lines of copied context
.TP
\fB\-u\fR, \fB\-U\fR NUM, \fB\-\-unified\fR[=\fINUM\fR]
output NUM (default 3) lines of unified context
.TP
\fB\-e\fR, \fB\-\-ed\fR
output an ed script
.TP
\fB\-n\fR, \fB\-\-rcs\fR
output an RCS format diff
.TP
\fB\-y\fR, \fB\-\-side\-by\-side\fR
output in two columns
.TP
\fB\-W\fR, \fB\-\-width\fR=\fINUM\fR
output at most NUM (default 130) print columns
.TP
\fB\-\-left\-column\fR
output only the left column of common lines
.TP
\fB\-\-suppress\-common\-lines\fR
do not output common lines
.TP
\fB\-p\fR, \fB\-\-show\-c\-function\fR
show which C function each change is in
.TP
\fB\-F\fR, \fB\-\-show\-function\-line\fR=\fIRE\fR
show the most recent line matching RE
.TP
\fB\-\-label\fR LABEL
use LABEL instead of file name and timestamp
(can be repeated)
.TP
\fB\-t\fR, \fB\-\-expand\-tabs\fR
expand tabs to spaces in output
.TP
\fB\-T\fR, \fB\-\-initial\-tab\fR
make tabs line up by prepending a tab
.TP
\fB\-\-tabsize\fR=\fINUM\fR
tab stops every NUM (default 8) print columns
.TP
\fB\-\-suppress\-blank\-empty\fR
suppress space or tab before empty output lines
.TP
\fB\-l\fR, \fB\-\-paginate\fR
pass output through 'pr' to paginate it
.TP
\fB\-r\fR, \fB\-\-recursive\fR
recursively compare any subdirectories found
.TP
\fB\-\-no\-dereference\fR
don't follow symbolic links
.TP
\fB\-N\fR, \fB\-\-new\-file\fR
treat absent files as empty
.TP
\fB\-\-unidirectional\-new\-file\fR
treat absent first files as empty
.TP
\fB\-\-ignore\-file\-name\-case\fR
ignore case when comparing file names
.TP
\fB\-\-no\-ignore\-file\-name\-case\fR
consider case when comparing file names
.TP
\fB\-x\fR, \fB\-\-exclude\fR=\fIPAT\fR
exclude files that match PAT
.TP
\fB\-X\fR, \fB\-\-exclude\-from\fR=\fIFILE\fR
exclude files that match any pattern in FILE
.TP
\fB\-S\fR, \fB\-\-starting\-file\fR=\fIFILE\fR
start with FILE when comparing directories
.TP
\fB\-\-from\-file\fR=\fIFILE1\fR
compare FILE1 to all operands;
FILE1 can be a directory
.TP
\fB\-\-to\-file\fR=\fIFILE2\fR
compare all operands to FILE2;
FILE2 can be a directory
.TP
\fB\-i\fR, \fB\-\-ignore\-case\fR
ignore case differences in file contents
.TP
\fB\-E\fR, \fB\-\-ignore\-tab\-expansion\fR
ignore changes due to tab expansion
.TP
\fB\-Z\fR, \fB\-\-ignore\-trailing\-space\fR
ignore white space at line end
.TP
\fB\-b\fR, \fB\-\-ignore\-space\-change\fR
ignore changes in the amount of white space
.TP
\fB\-w\fR, \fB\-\-ignore\-all\-space\fR
ignore all white space
.TP
\fB\-B\fR, \fB\-\-ignore\-blank\-lines\fR
ignore changes where lines are all blank
.TP
\fB\-I\fR, \fB\-\-ignore\-matching\-lines\fR=\fIRE\fR
ignore changes where all lines match RE
.TP
\fB\-a\fR, \fB\-\-text\fR
treat all files as text
.TP
\fB\-\-strip\-trailing\-cr\fR
strip trailing carriage return on input
.TP
\fB\-D\fR, \fB\-\-ifdef\fR=\fINAME\fR
output merged file with '#ifdef NAME' diffs
.TP
\fB\-\-GTYPE\-group\-format\fR=\fIGFMT\fR
format GTYPE input groups with GFMT
.TP
\fB\-\-line\-format\fR=\fILFMT\fR
format all input lines with LFMT
.TP
\fB\-\-LTYPE\-line\-format\fR=\fILFMT\fR
format LTYPE input lines with LFMT
.IP
These format options provide fine\-grained control over the output
.IP
of diff, generalizing \fB\-D\fR/\-\-ifdef.
.TP
LTYPE is 'old', 'new', or 'unchanged'.
GTYPE is LTYPE or 'changed'.
.IP
GFMT (only) may contain:
.TP
%<
lines from FILE1
.TP
%>
lines from FILE2
.TP
%=
lines common to FILE1 and FILE2
.TP
%[\-][WIDTH][.[PREC]]{doxX}LETTER
printf\-style spec for LETTER
.IP
LETTERs are as follows for new group, lower case for old group:
.TP
F
first line number
.TP
L
last line number
.TP
N
number of lines = L\-F+1
.TP
E
F\-1
.TP
M
L+1
.TP
%(A=B?T:E)
if A equals B then T else E
.IP
LFMT (only) may contain:
.TP
%L
contents of line
.TP
%l
contents of line, excluding any trailing newline
.TP
%[\-][WIDTH][.[PREC]]{doxX}n
printf\-style spec for input line number
.IP
Both GFMT and LFMT may contain:
.TP
%%
%
.TP
%c'C'
the single character C
.TP
%c'\eOOO'
the character with octal code OOO
.TP
C
the character C (other characters represent themselves)
.TP
\fB\-d\fR, \fB\-\-minimal\fR
try hard to find a smaller set of changes
.TP
\fB\-\-horizon\-lines\fR=\fINUM\fR
keep NUM lines of the common prefix and suffix
.TP
\fB\-\-speed\-large\-files\fR
assume large files and many scattered small changes
.TP
\fB\-\-color\fR[=\fIWHEN\fR]
color output; WHEN is 'never', 'always', or 'auto';
plain \fB\-\-color\fR means \fB\-\-color=\fR'auto'
.TP
\fB\-\-palette\fR=\fIPALETTE\fR
the colors to use when \fB\-\-color\fR is active; PALETTE is
a colon\-separated list of terminfo capabilities
.TP
\fB\-\-help\fR
display this help and exit
.TP
\fB\-v\fR, \fB\-\-version\fR
output version information and exit
.PP
FILES are 'FILE1 FILE2' or 'DIR1 DIR2' or 'DIR FILE' or 'FILE DIR'.
If \fB\-\-from\-file\fR or \fB\-\-to\-file\fR is given, there are no restrictions on FILE(s).
If a FILE is '\-', read standard input.
Exit status is 0 if inputs are the same, 1 if different, 2 if trouble.
.SH AUTHOR
Written by Paul Eggert, Mike Haertel, David Hayes,
Richard Stallman, and Len Tower.
.SH "REPORTING BUGS"
Report bugs to: bug\-diffutils@gnu.org
.br
GNU diffutils home page: <https://www.gnu.org/software/diffutils/>
.br
General help using GNU software: <https://www.gnu.org/gethelp/>
.SH COPYRIGHT
Copyright \(co 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
.br
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
.SH "SEE ALSO"
.BR wdiff (1),
.BR cmp (1),
.BR diff3 (1),
.BR sdiff (1),
.BR patch (1)
.PP
The full documentation for
.B diff
is maintained as a Texinfo manual.  If the
.B info
and
.B diff
programs are properly installed at your site, the command
.IP
.B info diff
.PP
should give you access to the complete manual.