Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.33.
.TH DIFF "1" "April 2004" "diffutils 2.8.7" "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.
.TP
\fB\-i\fR  \fB\-\-ignore\-case\fR
Ignore case differences in file contents.
.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\-E\fR  \fB\-\-ignore\-tab\-expansion\fR
Ignore changes due to tab expansion.
.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 whose lines are all blank.
.TP
\fB\-I\fR RE  \fB\-\-ignore\-matching\-lines\fR=\fIRE\fR
Ignore changes whose lines all match RE.
.TP
\fB\-\-strip\-trailing\-cr\fR
Strip trailing carriage return on input.
.TP
\fB\-a\fR  \fB\-\-text\fR
Treat all files as text.
.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\-\-label\fR LABEL
Use LABEL instead of file name.
.TP
\fB\-p\fR  \fB\-\-show\-c\-function\fR
Show which C function each change is in.
.TP
\fB\-F\fR RE  \fB\-\-show\-function\-line\fR=\fIRE\fR
Show the most recent line matching RE.
.TP
\fB\-q\fR  \fB\-\-brief\fR
Output only whether files differ.
.TP
\fB\-e\fR  \fB\-\-ed\fR
Output an ed script.
.TP
\fB\-\-normal\fR
Output a normal diff.
.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 NUM  \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\-D\fR NAME  \fB\-\-ifdef\fR=\fINAME\fR
Output merged file to show `#ifdef NAME' diffs.
.TP
\fB\-\-GTYPE\-group\-format\fR=\fIGFMT\fR
Similar, but format GTYPE input groups with GFMT.
.TP
\fB\-\-line\-format\fR=\fILFMT\fR
Similar, but format all input lines with LFMT.
.TP
\fB\-\-LTYPE\-line\-format\fR=\fILFMT\fR
Similar, but format LTYPE input lines with LFMT.
.TP
LTYPE is `old', `new', or `unchanged'.
GTYPE is LTYPE or `changed'.
.IP
GFMT 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
.IP
LFMT 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
Either GFMT or LFMT may contain:
.TP
%%
%
.TP
%c'C'
the single character C
.TP
%c'\eOOO'
the character with octal code OOO
.TP
\fB\-l\fR  \fB\-\-paginate\fR
Pass the output through `pr' to paginate it.
.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 are every NUM (default 8) print columns.
.TP
\fB\-r\fR  \fB\-\-recursive\fR
Recursively compare any subdirectories found.
.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\-s\fR  \fB\-\-report\-identical\-files\fR
Report when two files are the same.
.TP
\fB\-x\fR PAT  \fB\-\-exclude\fR=\fIPAT\fR
Exclude files that match PAT.
.TP
\fB\-X\fR FILE  \fB\-\-exclude\-from\fR=\fIFILE\fR
Exclude files that match any pattern in FILE.
.TP
\fB\-S\fR FILE  \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\-\-horizon\-lines\fR=\fINUM\fR
Keep NUM lines of the common prefix and suffix.
.TP
\fB\-d\fR  \fB\-\-minimal\fR
Try hard to find a smaller set of changes.
.TP
\fB\-\-speed\-large\-files\fR
Assume large files and many scattered small changes.
.TP
\fB\-v\fR  \fB\-\-version\fR
Output version info.
.TP
\fB\-\-help\fR
Output this help.
.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 FILES.
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-gnu-utils@gnu.org>.
.SH COPYRIGHT
Copyright \(co 2004 Free Software Foundation, Inc.
.br
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
.SH "SEE ALSO"
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.