| 1 |
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.5. |
| 2 |
.TH DIFF "1" "April 2025" "diffutils 3.12" "User Commands" |
| 3 |
.SH NAME |
| 4 |
diff \- compare files line by line |
| 5 |
.SH SYNOPSIS |
| 6 |
.B diff |
| 7 |
[\fI\,OPTION\/\fR]... \fI\,FILES\/\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[=\fI\,NUM\/\fR] |
| 23 |
output NUM (default 3) lines of copied context |
| 24 |
.TP |
| 25 |
\fB\-u\fR, \fB\-U\fR NUM, \fB\-\-unified\fR[=\fI\,NUM\/\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=\fI\,NUM\/\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=\fI\,RE\/\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=\fI\,NUM\/\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=\fI\,PAT\/\fR |
| 90 |
exclude files that match PAT |
| 91 |
.TP |
| 92 |
\fB\-X\fR, \fB\-\-exclude\-from\fR=\fI\,FILE\/\fR |
| 93 |
exclude files that match any pattern in FILE |
| 94 |
.TP |
| 95 |
\fB\-S\fR, \fB\-\-starting\-file\fR=\fI\,FILE\/\fR |
| 96 |
start with FILE when comparing directories |
| 97 |
.TP |
| 98 |
\fB\-\-from\-file\fR=\fI\,FILE1\/\fR |
| 99 |
compare FILE1 to all operands; |
| 100 |
FILE1 can be a directory |
| 101 |
.TP |
| 102 |
\fB\-\-to\-file\fR=\fI\,FILE2\/\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=\fI\,RE\/\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=\fI\,NAME\/\fR |
| 134 |
output merged file with '#ifdef NAME' diffs |
| 135 |
.TP |
| 136 |
\fB\-\-GTYPE\-group\-format\fR=\fI\,GFMT\/\fR |
| 137 |
format GTYPE input groups with GFMT |
| 138 |
.TP |
| 139 |
\fB\-\-line\-format\fR=\fI\,LFMT\/\fR |
| 140 |
format all input lines with LFMT |
| 141 |
.TP |
| 142 |
\fB\-\-LTYPE\-line\-format\fR=\fI\,LFMT\/\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=\fI\,NUM\/\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[=\fI\,WHEN\/\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=\fI\,PALETTE\/\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\[email protected] |
| 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 2025 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 |
.BR wdiff (1), |
| 255 |
.BR cmp (1), |
| 256 |
.BR diff3 (1), |
| 257 |
.BR sdiff (1), |
| 258 |
.BR patch (1) |
| 259 |
.PP |
| 260 |
The full documentation for |
| 261 |
.B diff |
| 262 |
is maintained as a Texinfo manual. If the |
| 263 |
.B info |
| 264 |
and |
| 265 |
.B diff |
| 266 |
programs are properly installed at your site, the command |
| 267 |
.IP |
| 268 |
.B info diff |
| 269 |
.PP |
| 270 |
should give you access to the complete manual. |