The diff command gives details of differences between two files. The cmp command simply tells you whether two files are the same or different.

$ diff one.txt two.txt

The results would be something like the following:

14c14
< txt txt txt
---
> text text text

The first line indicates the line number(s) which are different between files. The letter c indicates that line 14 must be changed for them to match. The < symbol refers to the text in the first file. > symbol refers to the second file.

The cmp command simply gives a yes|no answer. Ideal for comparing binary files. If the files are identical, no result is printed. If the files differ, the filename and the byte where the first difference is encountered is returned.

$ cmp one.txt two.txt