Main index | Section 1 | 日本語 | Deutsch | Options |
Output options (mutually exclusive):
| |
Like
| |
| |
Produces a diff with 3 lines of context.
With
| |
| |
Creates a merged version of file1 and file2 on the standard output, with C preprocessor controls included so that a compilation of the result without defining string is equivalent to compiling file1, while defining string will yield file2. | |
| |
Produces output in a form suitable as input for the editor utility,
ed(1),
which can then be used to convert file1 into file2.
Extra commands are added to the output when comparing directories with
| |
| |
Identical output to that of the
| |
| |
Produces a script similar to that of
| |
| |
Just print a line when the files differ. Does not output a list of changes. | |
| |
Like
| |
| |
Produces a
unified
diff with 3 lines of context.
A unified diff is similar to the context diff produced by the
| |
| |
Output in two columns with a marker between them.
The marker can be one
of the following:
| |
space | Corresponding lines are identical. |
'|' | Corresponding lines are different. |
'<' | Files differ and only the first file contains the line. |
'>' | Files differ and only the second file contains the line. |
Comparison options:
| |
Treat all files as ASCII text. Normally diff will simply print "Binary files ... differ" if files contain binary characters. Use of this option forces diff to produce a diff. | |
| |
Causes chunks that include only blank lines to be ignored. | |
| |
Causes trailing blanks (spaces and tabs) to be ignored, and other strings of blanks to compare equal. | |
| |
Try very hard to produce a diff as small as possible. This may consume a lot of processing power and memory when processing large files with many changes. | |
| |
Ignores changes, insertions, and deletions whose lines match the
extended regular expression
pattern.
Multiple
| |
| |
Ignores the case of letters. E.g., "A" will compare equal to "a". | |
| |
Pass the output through pr(1) to paginate it. | |
| |
Print label instead of the first (and second, if this option is specified twice) file name and time in the context or unified diff header. | |
| |
With unified and context diffs, show with each change the first 40 characters of the last line before the context beginning with a letter, an underscore or a dollar sign. For C source code following standard layout conventions, this will show the prototype of the function the change applies to. | |
| |
Print a tab rather than a space before the rest of the line for the normal, context or unified output formats. This makes the alignment of tabs in the line consistent. | |
| |
Will expand tabs in output lines.
Normal or
| |
| |
Is similar to
| |
| |
Output at most number columns when using side by side format. The default value is 130. | |
| |
Format input groups in the provided
the format is a string with special keywords: | |
%< | lines from FILE1 |
%< | lines from FILE2 |
| |
ignore case when comparing file names | |
| |
do not ignore case wen comparing file names (default) | |
| |
default diff output | |
| |
stub option for compatibility with GNU diff | |
| |
strip carriage return on input files | |
| |
Do not output common lines when using the side by side format | |
| |
Number of spaces representing a tab (default 8) | |
Directory comparison options:
| |
If a file is found in only one directory, act as if it was found in the other directory too but was of zero size. | |
| |
If a file is found only in dir2, act as if it was found in dir1 too but was of zero size. | |
| |
Causes application of diff recursively to common subdirectories encountered. | |
| |
Re-starts a directory diff in the middle, beginning with file name. | |
| |
Causes diff to report files which are the same, which are otherwise not mentioned. | |
| |
Exclude files and subdirectories from comparison whose basenames match
lines in
file.
Multiple
| |
| |
Exclude files and subdirectories from comparison whose basenames match
pattern.
Patterns are matched using shell-style globbing via
fnmatch(3).
Multiple
| |
If both arguments are directories, diff sorts the contents of the directories by name, and then runs the regular file diff algorithm, producing a change list, on text files which are different. Binary files which differ, common subdirectories, and files which appear in only one directory are described as such. In directory mode only regular files and directories are compared. If a non-regular file such as a device special file or FIFO is encountered, a diagnostic message is printed.
If only one of file1 and file2 is a directory, diff is applied to the non-directory file and the file contained in the directory file with a filename that is the same as the last component of the non-directory file.
If either file1 or file2 is '-', the standard input is used in its place.
XX aYY | At (the end of) line XX of file1, append the contents of line YY of file2 to make them equal. |
XX aYY,ZZ | Same as above, but append the range of lines, YY through ZZ of file2 to line XX of file1. |
XX dYY | At line XX delete the line. The value YY tells to which line the change would bring file1 in line with file2. |
XX,YY dZZ | Delete the range of lines XX through YY in file1. |
XX cYY | Change the line XX in file1 to the line YY in file2. |
XX,YY cZZ | Replace the range of specified lines with the line ZZ. |
XX,YY cZZ,QQ | |
Replace the range XX, YY from file1 with the range ZZ, QQ from file2. | |
These lines resemble ed(1) subcommands to convert file1 into file2. The line numbers before the action letters pertain to file1; those after pertain to file2. Thus, by exchanging a for d and reading the line in reverse order, one can also determine how to convert file2 into file1. As in ed(1), identical pairs (where num1 = num2) are abbreviated as a single number.
/tmp/diff.XXXXXXXX | |
Temporary file used when comparing a device or the standard input. Note that the temporary file is unlinked as soon as it is created so it will not show up in a directory listing. | |
0 | No differences were found. |
1 | Differences were found. |
>1 | An error occurred. |
Computing Science Technical Report, An Algorithm for Differential File Comparison, June 1976.
, , ,
The flags
[
DIFF (1) | June 1, 2020 |
Main index | Section 1 | 日本語 | Deutsch | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | When people say "Drive safe!" I'm like no, a safe is for keeping money, I drive car. | ” |
— Artur Bagyants |