1. Without GUI1.1 diff
Diff can compare two folders
Syntax: diff [Option] file1 file2 Description: This Command tells you which lines of file1 and file2 need to be modified to make the two files consistent. If "-" is used to represent file1 or fiie2, it indicates the standard input. If file1 or file2 is a directory, diff compares the files with the same name in the directory. Example: diff/usr/xu mine
The options are as follows:
-B ignores the spaces at the end of the line, and one or more space characters in the string are considered equal.
For example, How are you and How are you are treated as the same string.
-C uses the context output format (three rows of context are provided ).
-C n uses the context output format (n rows of context are provided ).
-E generates a valid ed script as the output.
-R when file1 and file2 are directories, recursion applies to each file and directory. 1.2 comm Syntax: comm [-123] file1 file2 Note: This command compares two sorted files. File1 and file2 are sorted files. Comm reads the two files and generates three output columns: only the rows that appear in file1, only the rows that appear in file2, And the rows that exist in both files. If the file name is "-", it indicates reading from the standard input. Comm-1 does not show the row that appears only in the first file. Comm-2 does not show rows that only appear in the Second file. Comm-3 does not display rows that appear in both files. Comm file1 file2 shows three columns. The first column indicates that only the row appears in file1, and the second column indicates that only the row appears in file2, the third column indicates the lines in which the two files appear at the same time. comm-12 indicates the lines in which the two files appear at the same time, that is, the intersection. comm-13 indicates that only the lines in the second file are displayed at comm-23. the row that appears in the first file is 1.3 colordiff in Linux, you can use the diff command to compare the files to understand their differences. However, the output results of the diff command are displayed in the same color, which may not be strong enough. Fortunately, we can also improve it through ColorDiff. ColorDiff is a Perl script that uses different colors to highlight the output results of the diff command, which is very conspicuous.
ColorDiff is applicable to Linux and BSD systems and has been included in Debian, Ubuntu, Gentoo, Arch Linux, Fedora, FreeBSD, and other releases. You can install it directly.
2. With GUI
Since there is no GUI, diff and comm are not so easy to use. We recommend several software with GUI below.
2.1 diffuse
I usually use this, which is very useful.You can also directly paste the content to the diffuse layout for direct comparison.
Visualized comparison is very intuitive.
Two-phase comparison and three-phase comparison are supported. This means that you can compare two or three text files at the same time using Diffuse.
Supports common version control tools, including CVS, subversion, git, and mercurial. You can obtain the source code from the version control system through Diffuse to compare and merge the source code.
Supports syntax highlighting in languages such as C ++, Python, Java, and XML.
You can directly edit files in Diffuse.
Supports UTF-8 encoding.
You can use shortcut keys to easily navigate.
2.2 KDiff3
KDiff3 is a tool used to compare and merge files or directories. It can be used to compare two or three files/directories at the same time. By comparison, it displays the differences between files and directories by row. At the same time, KDiff3 provides automated merge tools to help users perform merging operations.
In addition, KDiff3 supports Unicode encoding and integrates the editor to automatically merge version control history. Although KDiff3 is mainly developed for the KDE Desktop, it can still run in other Linux environments. KDiff3 even has corresponding versions for Windows and Mac OS X.
3. References
[1] Linux File compare command http://baike.baidu.com/link? Url = Response
[2] File difference comparison tool http://blog.csdn.net/baozi1159/article/details/7572819 in Linux