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

NAME

6       GNU diff - compare files line by line
7

SYNOPSIS

9       diff [OPTION]... FILES
10

DESCRIPTION

12       Compare FILES line by line.
13
14       Mandatory  arguments  to  long  options are mandatory for short options
15       too.
16
17       --normal
18              output a normal diff (the default)
19
20       -q, --brief
21              report only when files differ
22
23       -s, --report-identical-files
24              report when two files are the same
25
26       -c, -C NUM, --context[=NUM]
27              output NUM (default 3) lines of copied context
28
29       -u, -U NUM, --unified[=NUM]
30              output NUM (default 3) lines of unified context
31
32       -e, --ed
33              output an ed script
34
35       -n, --rcs
36              output an RCS format diff
37
38       -y, --side-by-side
39              output in two columns
40
41       -W, --width=NUM
42              output at most NUM (default 130) print columns
43
44       --left-column
45              output only the left column of common lines
46
47       --suppress-common-lines
48              do not output common lines
49
50       -p, --show-c-function
51              show which C function each change is in
52
53       -F, --show-function-line=RE
54              show the most recent line matching RE
55
56       --label LABEL
57              use LABEL instead of file name and timestamp (can be repeated)
58
59       -t, --expand-tabs
60              expand tabs to spaces in output
61
62       -T, --initial-tab
63              make tabs line up by prepending a tab
64
65       --tabsize=NUM
66              tab stops every NUM (default 8) print columns
67
68       --suppress-blank-empty
69              suppress space or tab before empty output lines
70
71       -l, --paginate
72              pass output through 'pr' to paginate it
73
74       -r, --recursive
75              recursively compare any subdirectories found
76
77       --no-dereference
78              don't follow symbolic links
79
80       -N, --new-file
81              treat absent files as empty
82
83       --unidirectional-new-file
84              treat absent first files as empty
85
86       --ignore-file-name-case
87              ignore case when comparing file names
88
89       --no-ignore-file-name-case
90              consider case when comparing file names
91
92       -x, --exclude=PAT
93              exclude files that match PAT
94
95       -X, --exclude-from=FILE
96              exclude files that match any pattern in FILE
97
98       -S, --starting-file=FILE
99              start with FILE when comparing directories
100
101       --from-file=FILE1
102              compare FILE1 to all operands; FILE1 can be a directory
103
104       --to-file=FILE2
105              compare all operands to FILE2; FILE2 can be a directory
106
107       -i, --ignore-case
108              ignore case differences in file contents
109
110       -E, --ignore-tab-expansion
111              ignore changes due to tab expansion
112
113       -Z, --ignore-trailing-space
114              ignore white space at line end
115
116       -b, --ignore-space-change
117              ignore changes in the amount of white space
118
119       -w, --ignore-all-space
120              ignore all white space
121
122       -B, --ignore-blank-lines
123              ignore changes where lines are all blank
124
125       -I, --ignore-matching-lines=RE
126              ignore changes where all lines match RE
127
128       -a, --text
129              treat all files as text
130
131       --strip-trailing-cr
132              strip trailing carriage return on input
133
134       -D, --ifdef=NAME
135              output merged file with '#ifdef NAME' diffs
136
137       --GTYPE-group-format=GFMT
138              format GTYPE input groups with GFMT
139
140       --line-format=LFMT
141              format all input lines with LFMT
142
143       --LTYPE-line-format=LFMT
144              format LTYPE input lines with LFMT
145
146              These format options provide fine-grained control over the  out‐
147              put
148
149              of diff, generalizing -D/--ifdef.
150
151       LTYPE is 'old', 'new', or 'unchanged'.
152              GTYPE is LTYPE or 'changed'.
153
154              GFMT (only) may contain:
155
156       %<     lines from FILE1
157
158       %>     lines from FILE2
159
160       %=     lines common to FILE1 and FILE2
161
162       %[-][WIDTH][.[PREC]]{doxX}LETTER
163              printf-style spec for LETTER
164
165              LETTERs are as follows for new group, lower case for old group:
166
167       F      first line number
168
169       L      last line number
170
171       N      number of lines = L-F+1
172
173       E      F-1
174
175       M      L+1
176
177       %(A=B?T:E)
178              if A equals B then T else E
179
180              LFMT (only) may contain:
181
182       %L     contents of line
183
184       %l     contents of line, excluding any trailing newline
185
186       %[-][WIDTH][.[PREC]]{doxX}n
187              printf-style spec for input line number
188
189              Both GFMT and LFMT may contain:
190
191       %%     %
192
193       %c'C'  the single character C
194
195       %c'\OOO'
196              the character with octal code OOO
197
198       C      the character C (other characters represent themselves)
199
200       -d, --minimal
201              try hard to find a smaller set of changes
202
203       --horizon-lines=NUM
204              keep NUM lines of the common prefix and suffix
205
206       --speed-large-files
207              assume large files and many scattered small changes
208
209       --color[=WHEN]
210              colorize  the  output;  WHEN can be 'never', 'always', or 'auto'
211              (the default)
212
213       --palette=PALETTE
214              the  colors  to  use  when  --color  is  active;  PALETTE  is  a
215              colon-separated list of terminfo capabilities
216
217       --help display this help and exit
218
219       -v, --version
220              output version information and exit
221
222       FILES are 'FILE1 FILE2' or 'DIR1 DIR2' or 'DIR FILE' or 'FILE DIR'.  If
223       --from-file or  --to-file  is  given,  there  are  no  restrictions  on
224       FILE(s).   If  a FILE is '-', read standard input.  Exit status is 0 if
225       inputs are the same, 1 if different, 2 if trouble.
226

AUTHOR

228       Written by Paul Eggert, Mike Haertel, David  Hayes,  Richard  Stallman,
229       and Len Tower.
230

REPORTING BUGS

232       Report bugs to: bug-diffutils@gnu.org
233       GNU diffutils home page: <http://www.gnu.org/software/diffutils/>
234       General help using GNU software: <https://www.gnu.org/gethelp/>
235
237       Copyright  ©  2018  Free Software Foundation, Inc.  License GPLv3+: GNU
238       GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
239       This is free software: you are free  to  change  and  redistribute  it.
240       There is NO WARRANTY, to the extent permitted by law.
241

SEE ALSO

243       wdiff(1), cmp(1), diff3(1), sdiff(1), patch(1)
244
245       The  full  documentation for GNU is maintained as a Texinfo manual.  If
246       the info and GNU programs are properly installed at your site, the com‐
247       mand
248
249              info GNU
250
251       should give you access to the complete manual.
252
253
254
255diffutils 3.7                    October 2020                           GNU(1)
Impressum