Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a neat way to see the difference between two binary files? They are mostly the same, but some bytes are changed, and one of the files has sequences inserted in some places.

Diffing the output of xxd would work if bytes were only changed, and not inserted.

share|improve this question
2  
i would graphically diff the hexdumps of both binaries with vimdiff –  user1146332 Dec 30 '12 at 13:43

2 Answers 2

There are a few binary editors that can show differences between files, but the ones I've tried (dhex and vbindiff) don't seem to be able to detect and show insertions or deletions.

There are a number of binary diff utilities like rdiff, xdelta or bsdiff that compute the difference between two files. But the purpose is to generate patch files to be later applied to an original. You can't read those patch files to see what the differences are.

Something you can do, to visually see the difference, is to hexdump the files with one byte per line and diff the results. The line numbers will tell you the offset in the file (though beware it starts at 1, not 0):

diff -u <(od -w1 -vAn -tx1 file1) <(od -w1 -vAn -tx1 file2)

(assuming your od supports the non-standard -w option).

share|improve this answer

try using dhex or jojodiff . You can also use bsdiff.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.