How to compare binary files to check if they are the same?

sawa picture sawa · Aug 25, 2012 · Viewed 221.1k times · Source

What is the easiest way (using a graphical tool or command line on Ubuntu Linux) to know if two binary files are the same or not (except for the time stamps)? I do not need to actually extract the difference. I just need to know whether they are the same or not.

Answer

Joe picture Joe · Aug 25, 2012

The standard unix diff will show if the files are the same or not:

[me@host ~]$ diff 1.bin 2.bin
Binary files 1.bin and 2.bin differ

If there is no output from the command, it means that the files have no differences.