But what happens when you locate two files that seem to be identical? The best way to tell the difference is with the cmp (compare) command:

Command Format

cmp file1 file2

Example

In this example the cmp command is used to identify the first occurrence of a difference between two files. The difference occurred at the 1638th character position and was found on line 42.

$ cmp ~/.bashrc ~/user2/.bashrc

bshrc user2/bshrc differ: char 1638, line 42