语法

diff [-abBcdefHilnNpPqrstTuvwy][-<行数>][-C <行数>][-D <巨集名称>][-I <字符或字符串>][-S <文件>][-W <宽度>][-x <文件或目录>][-X <文件>][--help][--left-column][--suppress-common-line][文件或目录1][文件或目录2]

命令用于比较文件的差异

diff以逐行的方式,比较文本文件的异同处。如果指定要比较目录,则diff会比较目录中相同文件名的文件,但不会比较其中子目录

diff t1.txt t2.txt

1.png

diff -y t1.txt t2.txt

2.png

diff -c t1.txt t2.txt

3.png

vimdiff t1.txt t2.txt

4.png