First, Introduction
The diff command is used to compare the contents of a file and is an integral part of the version control tools such as SVN, CVS, and Git.
Second, the grammar
-A or--The text diff preset will only compare a textual file by line. -B or--ignore-space-Change does not check for differences in space characters. -B or--ignore-blank-lines does not check for blank lines. -C Displays all the text and marks the difference. -C or--context with execution"-c-"directives are the same. -D or--minimal uses different algorithms to make comparisons in smaller units. -d or ifdef the output format of this parameter is available for the predecessor Processor macro. -E or--ed the output format of this parameter is available for the ed script file. -F or-forward-The ED output is formatted like an ED script file, but displays the differences in the order of the original files. -H or--speed-large-Files can speed up when comparing large files. -L or--ignore-matching-lines If two files are different in a few lines, and these lines both contain the characters or strings specified in the option, the differences between the two files are not displayed. -I. or--ignore- Casedoes not check for differences in case. -L OR--Paginate The results to the PR program for paging. -N OR--RCS Displays the comparison results in the form of RCS. -N or--new-fileWhen comparing directories, if file a only appears in a directory, the preset will display: Only in directory: file a If used-n parameter, diff compares file A to a blank file. -p If the file is compared to a C language code file, display the function name where the difference resides. -P or--unidirectional-new-fileandN, but only if the second directory contains a file that is not in the first directory, the file is compared to a blank file. -Q OR--brief shows only the difference and does not show detailed information. -R OR--recursive to compare files in subdirectories. -S or--report-identical-If files do not find any differences, the information is still displayed. -S or--starting-fileWhen you compare a table of contents, the comparison starts from the specified file. -T or--expand-tabs The tab character expands when the output is printed. -T or--initial-tab precedes each line with the tab character to align. -V OR--version displays release information. -W or--ignore-all-space ignores all whitespace characters. -W or--width in use-y parameter, specify the width of the column. -X or--Exclude does not compare the files or directories specified in the options. -X or--exclude-from you can save a file or directory type as a text file and thenThis text file is specified in the -Y or--side-by-side displays the similarities and differences of the files in a parallel manner. --Help displays assistance. --left-column in Use-y parameter, if the contents of one row of two files are the same, the contents of that row are displayed only on the left-hand column. --suppress-common-lines displays only the differences when using the-y parameter.
Third, examples
http://www.cnblogs.com/peida/archive/2012/12/12/2814048.html
Iv. diff enhancement
1) Colordiff
http://www.colordiff.org/
2) Icdiff
http://Www.jefftk.com/icdiff
Linux diff command