Hexdump

From LQWiki
Jump to navigation Jump to search

hexdump is used to look inside binary files. hexdump can display in many different ways.

Here's a selection from typing: hexdump -C /bin/bash

00096160  04 00 00 00 00 00 00 00  01 00 00 00 03 00 00 00  |................|
00096170  00 00 00 00 00 00 00 00  24 4c 09 00 db 00 00 00  |........$L......|
00096180  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 00  |................|
00096190  00 2e 73 68 73 74 72 74  61 62 00 2e 69 6e 74 65  |..shstrtab..inte|
000961a0  72 70 00 2e 6e 6f 74 65  2e 41 42 49 2d 74 61 67  |rp..note.ABI-tag|
000961b0  00 2e 68 61 73 68 00 2e  64 79 6e 73 79 6d 00 2e  |..hash..dynsym..|

Each hexadecimal character represents 4 bits. Each pair represents a byte.

The columns are as follows:

  1. A 32-bit address. (8 hex, *4 bits / hex, = 32 bits)
  2. 8 bytes at that address, left-to-right
  3. 8 more bytes
  4. the same 16 bytes, rendered as a string

Provided by

Most (all?) Linux distributions incorporate this from the [util-linux] project

See also

  • khexedit - Shows the same as hexdump and allows for editing.
  • od - Similar program for producing (usually) octal dumps. Can also print hex.