Difference between revisions of "Diff"

From wiki
Jump to navigation Jump to search
m
Line 1: Line 1:
[[Category:Shell]]
+
[[Category:Linux/Unix]]
 
On unix systems find differences between 2 files
 
On unix systems find differences between 2 files
  

Revision as of 20:50, 8 June 2019

On unix systems find differences between 2 files

diff file1 file2
diff -u file1 file2
diff -U <num> file1 file2
Report all differences between the files
Lines starting with < (-) need to be removed and starting with > (+) need to be added to go from file1 to file2
-u -U also report some lines before and after the actual difference (the context) (default 3) with -U <num> you can specify the number of context lines.