Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
diff(1)
Edit
PageHistory
Diff
Info
LikePages
DIFF !!!DIFF NAME SYNOPSIS DESCRIPTION SEE ALSO DIAGNOSTICS ---- !!NAME diff - find differences between two files !!SYNOPSIS __diff__ [[options] from-file to-file !!DESCRIPTION In the simplest case, ''diff'' compares the contents of the two files ''from-file'' and ''to-file''. A file name of __-__ stands for text read from the standard input. As a special case, __diff - -__ compares a copy of standard input to itself. If ''from-file'' is a directory and ''to-file'' is not, ''diff'' compares the file in ''from-file'' whose file name is that of ''to-file'', and vice versa. The non-directory file must not be __-__. If both ''from-file'' and ''to-file'' are directories, ''diff'' compares corresponding files in both directories, in alphabetical order; this comparison is not recursive unless the __-r__ or __--recursive__ option is given. ''diff'' never compares the actual contents of a directory as if it were a file. The file that is fully specified may not be standard input, because standard input is nameless and the notion of ``file with the same name'' does not apply. __diff__ options begin with __-__, so normally ''from-file'' and ''to-file'' may not begin with __-__. However, __--__ as an argument by itself treats the remaining arguments as file names even if they begin with __-__. __Options__ Below 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__ or __-u__. This option is obsolete. For proper operation, ''patch'' typically needs at least two lines of context. __-a__ Treat all files as text and compare them line-by-line, even if they do not seem to be text. __-b__ Ignore changes in amount of white space. __-B__ Ignore changes that just insert or delete blank lines. __--brief__ Report only whether the files differ, not the details of the differences. __-c__ Use the context output format. __-C__ ''lines'' __--context[[=__''lines''__]__ Use the context output format, showing ''lines'' (an integer) lines of context, or three if ''lines'' is not given. 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. __-d__ Change the algorithm to perhaps find a smaller set of changes. This makes ''diff'' slower (sometimes much slower). __-D__ ''name'' Make merged if-then-else format output, conditional on the preprocessor macro ''name''. __-e__ __--ed__ Make output that is a valid ''ed'' script. __--exclude=__''pattern'' When comparing directories, ignore files and subdirectories whose basenames match ''pattern''. __--exclude-from=__''file'' When comparing directories, ignore files and subdirectories whose basenames match any pattern contained in ''file''. __--expand-tabs__ Expand tabs to spaces in the output, to preserve the alignment of tabs in the input files. __-f__ Make output that looks vaguely like an ''ed'' script but has changes in the order they appear in the file. __-F__ ''regexp'' In context and unified format, for each hunk of differences, show some of the last preceding line that matches ''regexp''. __--forward-ed__ Make output that looks vaguely like an __ed__ script but has changes in the order they appear in the file. __-h__ This option currently has no effect; it is present for Unix compatibility. __-H__ Use heuristics to speed handling of large files that have numerous scattered small changes. __--horizon-lines=__''lines'' Do not discard the last ''lines'' lines of the common prefix and the first ''lines'' lines of the common suffix. __-i__ Ignore changes in case; consider upper- and lower-case letters equivalent. __-I__ ''regexp'' Ignore changes that just insert or delete lines that match ''regexp''. __--ifdef=__''name'' Make merged if-then-else format output, conditional on the preprocessor macro ''name''. __--ignore-all-space__ Ignore white space when comparing lines. __--ignore-blank-lines__ Ignore changes that just insert or delete blank lines. __--ignore-case__ Ignore changes in case; consider upper- and lower-case to be the same. __--ignore-matching-lines=__''regexp'' Ignore changes that just insert or delete lines that match ''regexp''. __--ignore-space-change__ Ignore changes in amount of white space. __--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. __-l__ Pass the output through ''pr'' to paginate it. __-L__ ''label'' __--label=__''label'' Use ''label'' instead of the file name in the context format and unified format headers. __--left-column__ Print only the left column of two common lines in side by side format. __--line-format=__''format'' Use ''format'' to output all input lines in in-then-else format. __--minimal__ Change the algorithm to perhaps find a smaller set of changes. This makes ''diff'' slower (sometimes much slower). __-n__ Output RCS-format diffs; like __-f__ except that each command specifies the number of lines affected. __-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. __--new-group-format=__''format'' Use ''format'' to output a group of lines taken from just the second file in if-then-else format. __--new-line-format=__''format'' Use ''format'' to output a line taken from just the second file in if-then-else format. __--old-group-format=__''format'' Use ''format'' to output a group of lines taken from just the first file in if-then-else format. __--old-line-format=__''format'' Use ''format'' to output a line taken from just the first file in if-then-else format. __-p__ Show which C function each change is in. __-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. __--paginate__ Pass the output through ''pr'' to paginate it. __-q__ Report only whether the files differ, not the details of the differences. __-r__ When comparing directories, recursively compare any subdirectories found. __--rcs__ Output RCS-format diffs; like __-f__ except that each command specifies the number of lines affected. __--recursive__ When comparing directories, recursively compare any subdirectories found. __--report-identical-files__ __-s__ Report when two files are the same. __-S__ ''file'' When comparing directories, start with the file ''file''. This is used for resuming an aborted comparison. __--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-c-function__ Show which C function each change is in. __--show-function-line=__''regexp'' In context and unified format, for each hunk of differences, show some of the last preceding line that matches ''regexp''. __--side-by-side__ Use the side by side output format. __--speed-large-files__ Use heuristics to speed handling of large files that have numerous scattered small changes. __--starting-file=__''file'' When comparing directories, start with the file ''file''. This is used for resuming an aborted comparison. __--suppress-common-lines__ Do not print common lines in side by side format. __-t__ Expand tabs to spaces in the output, to preserve the alignment of tabs in the input files. __-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. __--text__ Treat all files as text and compare them line-by-line, even if they do not appear to be text. __-u__ Use the unified output format. __--unchanged-group-format=__''format'' Use ''format'' to output a group of common lines taken from both files in if-then-else format. __--unchanged-line-format=__''format'' Use ''format'' to output a line common to both files in if-then-else format. __--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. __-U__ ''lines'' __--unified[[=__''lines''__]__ Use the unified output format, showing ''lines'' (an integer) lines of context, or three if ''lines'' is not given. For proper operation, ''patch'' typically needs at least two lines of context. __-v__ __--version__ Output the version number of ''diff''. __-w__ Ignore white space when comparing lines. __-W__ ''columns'' __--width=__''columns'' Use an output width of ''columns'' in side by side format. __-x__ ''pattern'' When comparing directories, ignore files and subdirectories whose basenames match ''pattern''. __-X__ ''file'' When comparing directories, ignore files and subdirectories whose basenames match any pattern contained in ''file''. __-y__ Use the side by side output format. !!SEE ALSO cmp(1), comm(1), diff3(1), ed(1), patch(1), pr(1), sdiff(1). !!DIAGNOSTICS An exit status of 0 means no differences were found, 1 means some differences were found, and 2 means trouble. ----
15 pages link to
diff(1)
:
merge(1)
Man1d
cmp(1)
bzdiff(1)
diff3(1)
gendiff(1)
perlbug(1)
perlhist(1)
rcsdiff(1)
sdiff(1)
zcmp(1)
zdiff(1)
PatchNotes
patch(1)
LinuxIsNotWindows
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.