Sometime you need to compare files. Sometime you know they differ but not how and sometime you don't even know if they are different.
md5sum can tell you if the files are identical. You could also use diff, but md5sum lets you see it wher you just have to take diff's word for it.
if [ $(md5 -q 1.txt) == $(md5 -q 2.txt) ]; then echo "same"; else echo "different"; fiIf there is ANY difference in the files AT ALL the check sum (a 32 digit alpha-numeric string) will be different for the files compared.
To see the checksum string run the command manually for each file:
One of my favorite tools for comparing files (especially text files) is Meld (http://meldmerge.org/). Meld is available for Linux and Windows. Meld shows you the two files side by side and highlights the differences. The greater the similarity the better Meld is at showing you where the differences are. The greater the dis-similarity the more difficult it becomes to see the similarities. Meld can also compare two directory trees showing you where files may be extra, missing, or mis=placed.