linux比较文件夹的差异命令

可以使用

diff -ruNa s1 s2 

或者使用

diff -uN c1 c2 

结果如下:

sandbox$ tree
.
|-- dir1
|   |-- a.txt
|   `-- b.txt
`-- dir2
    |-- b.txt
    `-- c.txt
 
2 directories, 4 files
sandbox$ diff -ruNa dir1 dir2
diff -ruNa dir1/a.txt dir2/a.txt
--- dir1/a.txt    2011-08-24 22:44:36.000000000 +0800
+++ dir2/a.txt    1970-01-01 08:00:00.000000000 +0800
@@ -1 +0,0 @@
-this is a.txt
diff -ruNa dir1/b.txt dir2/b.txt
--- dir1/b.txt    2011-08-24 22:44:45.000000000 +0800
+++ dir2/b.txt    2011-08-24 22:44:57.000000000 +0800
@@ -1 +1 @@
-this is b.txt
+this is b2 txt.
diff -ruNa dir1/c.txt dir2/c.txt
--- dir1/c.txt    1970-01-01 08:00:00.000000000 +0800
+++ dir2/c.txt    2011-08-24 22:45:07.000000000 +0800
@@ -0,0 +1 @@
+this is c txt.
sandbox$ 

 

posted @ 2017-12-11 12:16  一菲聪天  阅读(6284)  评论(0编辑  收藏  举报