Binary file comparison
KDiff3 compares two or three text files and shows the differences between them line by line and even character by character. KDiff3 works on Unix systems like Linux as well as Windows. You can compare two or three files with the differences highlighted. It also has the ability to merge files, unmerge CVS conflicts into two separate files so that you can resolve the conflicts, etc.
It uses an external diff program that is compatible with GNU diff presumably in its interface. ExamDiff shows you the difference between two ASCII text files Unicode not supported by displaying the two files side by side with the changes in different colours. You can configure the colours used. DiffMerge allows you to visually compare and merge files by graphically showing you the differences between them. Intra-line highlighting of differences is supported along with support for editing the files.
You can also perform a side-by-side comparison of 2 folders; the folder diff facility will show you the files that are only present in one folder as well as distinguish between those that are identical and those that are different. It's Merge facility allows you to see the changes between 3 files, automatic merging when safe, and the ability to edit the resulting file.
The Windows version features Windows Explorer integration. Diffuse can compare an arbitrary number of files side by side. You can manually correct the output so that the matching lines are aligned as well as edit the files directly from the utility. Other features include syntax highlighting, Unicode UTF-8 support, unlimited undo, etc. To link to this page from your website, simply cut and paste the following code to your web page.
Free File Comparison and Differencing Utilities. This page was last updated on 24 March If you find this site useful, please link to us. Free File Comparison Utilities The file comparison tools on this page are useful in a few ways. Lexical Analyzers, Parser Generators, etc Free File Comparison Utilities diff tools Diffinity This is a free diff program that compares two text files including Unicode ones and displays the results side by side with the differences highlighted.
WinMerge WinMerge is a Windows file differencing and merging tool. Java xdelta This is a Java version of xdelta, a program that can make binary diffs of two files. GNU Diff Utilities If you need to compare two text files and get a report of which lines have changed, the GNU command line diff utilities can show you those differences.
Questions Tags Users Badges Unanswered. Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute: Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top. How do I compare binary files in Linux? Peter Mortensen 8, 15 57 What's ugly about a one-liner? Perhaps it'd be worth having a look at it.
This will print the offset and bytes in hex: For example, cmp -l file1. Unfortunately, this gives me awk: Specific AWK implementation perhaps? In any case, GAWK can be installed and set to the default see also man update-alternatives. See my updated answer for a solution that doesn't require strtonum. This worked great for me with opendiff on OS X instead of vimdiff — the default view xxd provides keeps the diff engine on track comparing byte-by-byte.
This command does not work well for byte addition removal, as every line that follows will be misaligned and seen as modified by diff. The solution is to put 1 byte per line and remove the address column as proposed by John Lawrence Aspden and me. Your answer is perfect okay for small files, but not so okay for big ones. DHEX is awesome is comparing binaries is what you want to do.
Feed it two files and it takes you right to a comparative view, highlighting to differences, with easy ability to move to the next difference. Also it's able to work with large terminals, which is very useful on widescreen monitors. VBinDiff doesn't work with wide terminals though. But the addresses become weird with wide terminals anyway, since you have more than 16 bytes per row.
DanielBeauyat compressed files will be completely different after you encounter the first different byte. The output is not likely to be useful. But, as Mark Ransom said, that would be generally not wise on compressed files; the exception is "synchronizable" compressed formats like that produced by gzip --rsyncable , in which small differences in the uncompressed files should have a limited effect on the compressed file.
If you don't have colordiff, this will do the same thing without colors: If you just want to know whether both files are actually the same, you can use the -q or --brief switch, which will only show output when the files differ.
I prefer od over xxd because: It is crucial to have one byte per line, or else every line after a deletion would become out of phase and differ. I'd recommend hexdump for dumping binary files to textual format and kdiff3 for diff viewing.