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