diff [options] [diroptions] file1 file2diff 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 bdiff, cmp, comm, diff3, dircmp, and sdiff.
Options -c, -C, -D, -e, -f, -h, and -n cannot be combined with each other (they are mutually exclusive).
-bIgnore repeating blanks and end-of-line blanks; treat successive blanks as one.
-cProduce output in alternate format, with three lines of context. (This is called a "context diff.")
-CnLike -c, but produce n lines of context.
-D defMerge file1 and file2 into a single file containing conditional C preprocessor directives (#ifdef). Defining def and then compiling yields file2; compiling without defining def yields file1.
-eProduce a script of commands (a, c, d) to recreate file2 from file1 using the ed editor.
-fProduce a script to recreate file1 from file2; the script is in the opposite order, so it isn't useful to ed.
-hDo a half-hearted (but hopefully faster) comparison; complex differences (e.g., long stretches of many changes) may not show up; -e and -f are disabled.
-iIgnore uppercase and lowercase distinctions.
-nLike -f, but counts changed lines. rcsdiff works this way.
-tExpand tabs in output lines; useful for preserving indentation changed by -c format.
-wLike -b, but ignores all spaces and tabs; e.g., a + b is the same as a+b.
The following diroptions are valid only when both file arguments are directories.
-lLong format; output is paginated by pr so that diff listings for each file begin on a new page; other comparisons are listed afterward.
-rRun diff recursively for files in common subdirectories.
-sReport files that are identical.
-SfileBegin directory comparisons with file, skipping files whose names alphabetically precede file.