You need to use a Linux-cmd-line application to compare binary files and exit the first incorrect match

Is there a Linux command line application that will compare two binaries and exit the first incorrect match?

cmpseems to have no way out.

+5
source share
2 answers

cmp does not have this option, since it always leaves the first mismatch.

$ cmp -b /bin/ls /bin/sed
/bin/ls /bin/sed differ: byte 25, line 1 is 320 M-P 300 M-@
+11
source

I think you could use 3 tools:

  • cmp
  • diff
  • md5sum

cmp , diff diff , . diff .

, . diff -q, cmp -s, : 0, 1, .

cmp , () (, ): , N N M, (.. N = 10 M = 20):

cmp file1 file2 10 20 

md5sum , , MD5 , , , , . , .

+4

All Articles