How to find if two binary files differ or not
The standard “diff” command can be used to find if two binary files differ from each other or not. The following example shows how to do it.
[neo@techpulp ~]# diff file1.bin file2.bin Binary files file1.bin and file2.bin differ [neo@techpulp ~]#
Another way to find that out is to compute MD5 digest on both files and see if they match. MD5 is an cryptographic algorithm which computes an unique digest for each file. The both files are same if the MD5 digests of both files match and otherwise they differ. The “md5sum” command can be used to compute MD5 digest.
[neo@techpulp ~]# md5sum file1.bin file2.bin 4714b62a51a4057fa73a1ded36b75143 file1.bin f1d00a4f6a0c139d98bd2d4a56e20274 file2.bin [neo@techpulp ~]#
In the above example, the digests don’t match so you can conclude that the both files are not same.
Similar to “md5sum“, there is “sha1sum” command which uses SHA1 cryptographic algorithm.
If you have downloaded or uploaded a large file, you can use “md5sum” command to find out if your file is not corrupted along with file size comparison.

