English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Comprehensive List of Linux Commands
Linux diffstat命令根据diff的比较结果,显示统计数字。
diffstat读取diff的输出结果,然后统计各文件的插入,删除,修改等差异计量。
diff [-wV][-n <文件名长度>][-p <文件名长度>]
参数:
Users can also directly use "|" to pass the output of the 'diff' command to the 'diffstat' command for statistical display.
When using this command, if the file or subdirectory to be compared is not in the current directory, the complete path should be used.
Use the directory "test1"and"test2"Under the same name file "testf.txt" use the 'diff' command to compare. Then use the 'diffstat' command to display the statistical results, input the following command:
$ diff test1 test2 | diffstat #Display the statistical results of the comparison
Note: This command can very conveniently implement the function of statistical display.
To view the content of a file, users can view it by using the 'cat' command. The specific operation is as follows:
$ cat test1/testf.txt #View test1/Content of testf abc def ghi jkl mno pqr stu vws $ cat test2/testf.txt #View test2/Content of testf abc def ghi jkl mno
From the above file content display, it can be seen that the differences between the contents of the two files. Now let's run the command just now to display the statistical results of the file comparison, as follows:
testfile | 2 +- Display of Statistical Information 1 file changed, 1 insertion(+), 1 deletion(-)