qdiff - quick binary files differ



qdiff is a binary files differ that can detect binary insertions/deletions/substitutions with colorful outputs. It is released under GPL version 2.


The differences can be printed in various ways, very colorful output (insertions/deletions/substitutions), simple yet effective syncro engine, useful and fast for large files with few differences (e.g. verifying correctness of grabbed cdda data).


Usage Help

Usage: qdiff [OPTION]... FILE1 FILE2

diff options:
-b --byte-by-byte        compare files byte by byte, like 'cmp'
-f --no-heuristics       do not use heuristics to speed up large differing
                         blocks, note that the result is always correct but
                         with this option you may find a smaller number of
                         differing bytes
-m --min-match=NUM       allow resynchronisation only after a minimum of NUM
                         bytes match, this is an important parameter: lower
                         values may result in a more detailed analysis or in
                         useless results, higher values give a coarse analysis
                         but resynchronisation is more robust (range=[1..],
-O --large-files         optimize disk access for large files on the same disk
                         (locks 16MB mem)

output modes:  (override automatic file type determination)
-a --formatted           print formatted ascii text, line by line
-u --unformatted         print unformatted ascii text, block by block
-x --hex                 print hex dump, block by block
-t --vertical            print one byte per line (ignores width)

output options:
-c --no-color            disable ansi coloring of output
-C --alt-colors          no bold ansi coloring (for SGI terminals and the like)
-w --width=NUM           output maximal NUM chars (default is terminal width)
-B --bytes-per-line=NUM  print NUM bytes/chars per line
-T --tab-size=TABSIZE    TABSIZE in formatted mode (range=[1..], default=8)
-l --line-numbers        print line numbers in formatted mode
-n --no-line-break       truncate (not break) lines in formatted mode
-L --show-lf-and-tab     show newline/tab as <LF>/<HT> in formatted mode
-S --show-space          show space as <SPC> in non hex modes
-U --unprintable=CHAR    print CHAR for unprintable chars in non hex modes
-H --control-hex         print control codes in hex (<x1B>, not <ESC>)
-A --alignment-marks     print -/+ before 32/64-bit words in hex mode
-e --stop-on-eof         stop when end of a file is reached in vertical mode
   --hide-match          do not print matches
   --hide-deletion       do not print deletions
   --hide-insertion      do not print insertions
   --hide-substitution   do not print substitutions
   --range-match         print match as byte range
   --range-deletion      print deletion as byte range
   --range-insertion     print insertion as byte range
   --range-substitution  print substitution as two byte ranges
-R --range               print everything as byte range

common options:
-v --verbose             verbose execution
-P --progress            show progress during work
-h --help                print this help message, then exit successfully
   --version             print version, then exit successfully

qdiff version 0.9.1
 *** (C) 1997-1999 by Johannes Overmann
 *** (C) 2008 by Tong Sun

Build & Installation


make install

If you want to debug use:

make CXXFLAGS="-Wall -W -g"

instead of


Usage examples

Example 1, where are the symbol tables in executables

Let's build an executable with debug symbols embedded:

make clean
make CXXFLAGS="-Wall -W -g"

Then strip it after making a copy:

cp qdiff qdiff.dbg
strip qdiff
$ ls -l qdiff.dbg qdiff
-rwxr-xr-x 1 tong tong 211640 10-21 10:06 qdiff
-rwxr-xr-x 1 tong tong 814499 10-21 10:06 qdiff.dbg

Wow, quite a difference. What has strip done?

qdiff -R qdiff.dbg qdiff


FYI, I made an alias for this qdiff -R command for myself:

$ alias diffb
alias diffb='qdiff -R'

With it you can

diffb bin_file1 bin_file2

Example 2, dvdauthor magic tricks

Let's see what magic tricks have been played to mpeg videos after making it into DVD VOB file.

First we use dvdauthor to turn an mpeg video into DVD:

$ dvdauthor -o dvdauth -t test.mpg
 . . .
INFO: Generating VTS with the following video attributes:
INFO: MPEG version: mpeg2
INFO: TV standard: pal
INFO: Aspect ratio: 16:9
INFO: Resolution: 704x576
INFO: Audio ch 0 format: ac3/6ch, 48khz drc
$ dvdauthor -o dvdauth -T
 . . .
INFO: dvdauthor creating table of contents
INFO: Scanning dvdauth/VIDEO_TS/VTS_01_0.IFO

Now let's see what has happened:

diffb test.mpg dvdauth/VIDEO_TS/VTS_01_1.VOB


These two examples are just one way of using the qdiff's many output options to look at the changes. Check out the above "Usage Help" for more options.