Name
diff
Synopsis
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 converts
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
cmp, comm, diff3, dircmp, and sdiff.
GNU/Linux and Mac OS X use GNU diff. See http://www.gnu.org/software/diffutils.
Common Options
Options -c, -C,
-D, -e, -f,
-h, -n, -u
cannot be combined with each other (they are mutually
exclusive).
-b,--ignore-space-changeIgnore repeating blanks and end-of-line blanks; treat successive blanks as one.
-
-c Produce output in “context diff” format, with three lines of context.
-Cn,--context=nLike
-c, but produce n lines of context.-Dsymbol,--ifdef=symbolMerge file1 and file2 into a single file containing conditional C preprocessor directives (
#ifdef). Defining symbol and then compiling yields file2; compiling without defining symbol yields file1 ...