October 11, 2016

hexdump is awesome

It can dump binary with any specified format

hexdump -e '"optional-start" iterations/number_of_bytes "format" "optional-ending"'

Example 1:
  hexdump -e '16/1 "%02X " "\n"' x.bin
dumps 16 bytes in a row one-byte-at-a-time, and then adds line return at the row.
To add an offset to each line in the format of 0x0000:
  hexdump -e '"0x%04_ax " 16/1 "%02X "  "\n"'
Example 2:
  hexdump -e '"[" 12/1 "%02 " "]\n"' x.bin

dumps 12 bytes in a row with [ in the beginning and ] at the end.


No comments:

Post a Comment