You can use the diff command to compare text files.
Here is an example to display the differences between file1 and file2.
diff file1 file2
Here is another example to compare file1 and file2 while ignoring differences in white space.
diff -w file1 file2
If the two files differ only in the number of spaces and tabs between words, the diff -w command does not consider the files to be different.