cmd

The cmd command will compare two files and report the position of the first difference, if one exists.

Example:  cmd file2 file2

Will report the position of the first difference or nothing if the files are the same.

diff

The diff command will compare two files and list the differences.

Example: diff file1 file2

Will list all of the differences between file1 and file2 by showing how file1 should be modified to become identical to file2. Below are some sample output of the diff command.

comm

The comm command can be used to find lines that are unique to one file, unique to the other file, or in common to both.  Both files must be sorted.

Below are some examples: