I have two files and I want to see if the first 40 bytes are similar. How can I do this using hex dump?
If you are using the BSD
hexdump utility (which will also be installed as
hd, with a different default output format) then you can supply the
-n40 command line parameter to limit the dump to the first 40 bytes:
hexdump -n40 filename
If you are using the Posix standard
od, you need a capital
N. You might find the following invocation useful:
od -N40 -w40 -tx1 -Ax filename
(You can do that with
hexdump, too, but the format string is more work to figure out :) ).