Diff command will examine both file1 and file2 and tells you what changes need to be made for file1 and file2 to match.
$diff file1.txt file2.txt
Alternatively, you can have side-by-side merge of file differences
You can get a clear-cut visual difference between two text files using the command sdiff:
$ sdiff file1.txt file2.txt
These commands can be used for comparing directories as well.