Linux bdiff command

Updated: 05/04/2019 by Computer Hope
bdiff command

On Unix-like operating systems, the bdiff command calculates and reports the diffs for two very big files.

Note: Bdiff is a Unix heirloom (legacy) command, and may not be available for installation by your operating system's package manager.


The bdiff command compares the files specified by the filename1 and filename2 parameters and writes information about their differing lines to standard output. If either file name is - (a single dash), bdiff reads from standard input. The bdiff command is used like the diff command to find lines that must be changed in two files to make them identical. Some files are too large for diff to process, however, and that's where bdiff can be used.

bdiff ignores lines common to the beginning of both files, splits the remainder of each file into segments of number lines each, and then tells diff to compare the corresponding segments. By default, the number parameter is 3500 lines. In some cases, even 3500 lines at a time is too large for diff to work with; if diff fails, try using a smaller value for number.

Output of bdiff has the same format as normal diff output, except bdiff line numbers are adjusted to account for the segmenting of the files. It should be noted that because the files are segmented, bdiff does not necessarily find the smallest possible set of file differences.


bdiff { filename1 | - } { filename2 | - } [ number ] [ -s ]



Name of first file to compare.


Name of second file to compare.


Specifies the number of lines each file should be segmented into. The value of number is 3500 by default.


Tells bdiff to be silent (no diagnostic output). However, this does not suppress possible diagnostic messages from diff itself.


bdiff myfile1.txt myfile2.txt

Compare the files myfile1.txt and myfile2.txt. Results will be formatted similar to the following output:

< is this ln
> test
< Hello world
< this is a test
< of the bdiff file

diff — Identify the differences between two files.