diff
[options
] [diroptions
]file1
file2
diff reports lines that differ between file1
and
file2
. Output consists of lines of context from each file, with
file1
text flagged by a < symbol and file2
text, by a
> symbol. Context lines are preceded by the ed command
(a, c, or d) that would be used to convert
file1
to file2
. If one of the files is -, standard
input is read. If one of the files is a directory, diff locates
the filename in that directory corresponding to the other argument
(e.g., diff my_dir junk is the same as diff my_dir/junk
junk). If both arguments are directories, diff reports lines
that differ between all pairs of files having equivalent names (e.g.,
olddir/program and newdir/program); in addition,
diff lists filenames unique to one directory, as well as
subdirectories common to both. See also sdiff and cmp.
Ignore repeating blanks and end-of-line blanks; treat successive blanks as one.
Produce output in alternate format, with three lines of context.
n
Like -c, but produce n
lines of context.
n
Produce n
lines of context (default is 3).
def
Merge file1
and file2
into a single file containing
conditional C preprocessor directives (#ifdef). Defining
def
and then compiling will yield file2
; compiling without
defining def
yields file1
.
Produce a script of commands (a, c, d) to
recreate file2
from file1
using the ed editor.
Produce a script to recreate file1
from file2
; the script
is in the opposite order, so it isn't useful to ed.
Do a half-hearted comparison; complex differences (e.g., long stretches of many changes) may not show up; -e and -f are disabled.
Ignore uppercase and lowercase distinctions.
Like -f, but counts changed lines. rcsdiff works this way.
Expand tabs in output lines; useful for preserving indentation changed by -c format.
Like -b but ignores all spaces and tabs; e.g., a + b is the same as a+b.
Options -c,
-C,
-D, -e, -f, -h, and -n
cannot be combined with each other (they are mutually exclusive).
The following
diroptions
are valid only when both file arguments are
directories.
Long format; output is paginated by pr so that diff listings for each file begin on a new page; other comparisons are listed afterward.
Run diff recursively for files in common subdirectories.
Report files that are identical.
file
Begin directory comparisons with file
, skipping files whose names
are alphabetically before file
.