我有两个目录 – 一个来自早期备份,另一个来自最新备份.如何比较
Linux上最新备份对目录中文件所做的更改?另外我如何显示例如文本和PHP文件的变化 – 我正在考虑像维基百科上的修订历史,你在屏幕的一侧看到旧版本,在其他版本上看到最新版本,并突出显示更改.我如何实现这样的目标?
编辑:
我如何比较远程目录与本地?
解决方法
来自diff手册页:
If both from-file and to-file are directories,diff compares corresponding files in both directories,
in alphabetical order; this comparison is not recursive unless the -r or –recursive option is given.
diff never compares the actual contents of a directory as if it were a file. The file that is fully
specified may not be standard input,because standard input is nameless and the notion of ‘‘file with
the same name’’ does not apply.
所以要比较目录:diff –brief -r dir1 dir2
并排比较文件:diff –side-by-side file1 file2