The following is a summary of all of the options that GNU diff accepts. Most options have two equivalent names, one of which is a single
letter preceded by '-', and the other of which is a long name preceded by '--'. Multiple single letter options (unless they take an argument) can be
combined into a single command line word: '-ac' is equivalent to '-a -c'. Long named options can be abbreviated to any unique prefix of their name.
Brackets ([ and ]) indicate that an option takes an optional argument.
'
- lines'
Show lines (an integer) lines of context. This option does not specify an output format
by itself; it has no effect unless it is combined with '-c' (see Context Format) or '-u' (see Unified Format). This option is obsolete. For proper operation, patch typically needs at least two lines of context.
-C lines'
'--context[=lines]'
Use the context output format, showing lines (an integer) lines of context, or three if lines is not given. See Context Format. For proper operation, patch typically needs at least two lines of context.
'
--changed-group-format=format'
Use format to output a line group containing differing lines from both files in
if-then-else format. See Line Group Formats.
'
-d'
Change the algorithm perhaps find a smaller set of changes. This makes diff slower (sometimes much slower). See diff Performance Tradeoffs.
'
-D name'
Make merged '#ifdef' format output, conditional on the pre-processor macro name. See Merging Files with If-then-else.
'
-e'
'--ed'
Make output that is a valid ed script. See ed Scripts.
'
--exclude= pattern'
When comparing directories, ignore files and subdirectories whose basenames
match pattern. See Comparing Directories.
'
--exclude-from= file'
When comparing directories, ignore files and subdirectories whose basenames
match any pattern contained in file. See Comparing Directories.
'
--expand-tabs'
Expand tabs to spaces in the output, to preserve the align-ment of tabs in the
input files. See Preserving Tabstop Alignment.
'
-f'
Make output that looks vaguely like an ed script but has changes in the order
they appear in the file. See Forward ed Scripts.
'
-F regexp'
In context and unified format, for each hunk of differences, show some of the
last preceding line that matches regexp. See "Showing Lines That Match Regular Expressions" in Showing Which Sections Differences Are in.
'
--forward-ed'
Make output that looks vaguely like an ed script but has changes in the order they appear in the file. See Forward ed Scripts .
'
-h'
This option currently has no effect; it is present for Unix compatibility.
'
-H'
Use heuristics to speed handling of large files that have nu-merous scattered
small changes. See diff Performance tradeoffs .
'
--horizon-lines=lines'
Do not discard the last lines lines of the common prefix and the first lines lines of the common suffix. See diff Performance tradeoffs.
'
-i'
Ignore changes in case; consider uppercase and lowercase letters equivalent.
See Suppressing Case Differences.
'
-I regexp'
Ignore changes that just insert or delete lines that match regexp. See "Showing Lines That Match Regular Expressions" in Showing Which Sections Differences Are in.
--initial-tab'
Output a tab rather than a space before the text of a line in normal or
context format. This causes the alignment of tabs in the line to look normal. See Preserving Tabstop Alignment.
-L label'
Use label instead of the file name in the context format (see "Detailed Description of
Context Format" in Context Format) and unified format (see "Detailed Description of Unified Format" in Unified Format ) headers. See RCS Scripts.
'
--label=label'
Use label instead of the file name in the context format (see "Detailed Description of
Context Format" in Context Format) and unified format (see "Detailed Description of Unified Format" in Unified Format) headers.
--line-format=format'
Use format to output all input lines in if-then-else format. See Line Formats.
'
--minimal'
Change the algorithm to perhaps find a smaller set of changes. This makes diff slower (sometimes much slower). See diff Performance Tradeoffs.
'
-n'
Output RCS-format diffs; like '-f' except that each command specifies the number of lines affected. See RCS Scripts.
'
-N'
'--new-file'
In directory comparison, if a file is found in only one directory, treat it as
present but empty in the other directory. See Comparing Directories.
'
--new-group-format=format'
Use format to output a group of lines taken from just the second file in if-then-else format. See Line Group Formats.
'
--new-line-format=format'
Use format to output a line taken from just the second file in if-then-else format. See Line Formats.
'
--old-group-format=format'
Use format to output a group of lines taken from just the first file in if-then-else
format. See Line Group Formats.
'
--old-line-format=format'
Use format to output a line taken from just the first file in if-then- else format. See Line Formats.
-P'
When comparing directories, if a file appears only in the second directory of
the two, treat it as present but empty in the other. See Comparing Directories.
-S file'
When comparing directories, start with the file, file. This is used for resuming an aborted comparison. See Comparing Directories.
'
--sdiff-merge-assist'
Print extra information to help sdiff. sdiff uses this option when it runs diff. This option is not intended for users to use directly.
--show-function-line=regexp'
In context and unified format, for each hunk of differences, show some of the
last preceding line that matches regexp. See "Showing Lines That Match Regular Expressions" in Showing Which Sections Differences Are in.
--speed-large-files'
Use heuristics to speed handling of large files that have nu-merous scattered
small changes. See diff Performance Tradeoffs.
'
--starting-file=file'
When comparing directories, start with the file, file. This is used for resuming an aborted comparison. See Comparing Directories.
-t'
Expand tabs to spaces in the output, to preserve the alignment of tabs in the
input files. See Preserving Tabstop Alignment.
'
-T'
Output a tab rather than a space before the text of a line in normal or
context format. This causes the alignment of tabs in the line to look normal. See Preserving Tabstop Alignment.
--unchanged-group-format=format'
Use format to output a group of common lines taken from both files in if-then-else
format. See Line Group Formats.
'
--unchanged-line-format=format'
Use format to output a line common to both files in if-then-else format. See Line Formats.
'
--unidirectional-new-file'
When comparing directories, if a file appears only in the second directory of
the two, treat it as present but empty in the other. See Comparing Directories.
'
-U lines'
'--unified[= lines]'
Use the unified output format, showing lines (an integer) lines of context, or three if lines is not given. See Unified Format. For proper operation, patch typically needs at least two lines of context.
'
-v'
'--version'
Output the version number of diff.