Linux Command - od
The linux od command can display files in octal and other file formats.
Display a binary file in octal:
od /usr/bin/ls
Nice hex format with single byte units and a column of printable characters.
od -A x -t x1z -v
Only 100 bytes:
od -N 100 /usr/bin/ls
Common options:
-A x | hex for file offsets |
-t x1 | hex, 1 byte unit |
-t x1z | hex, 1 byte unit, display a column of printable chars |
-t o2 | octal, 2 byte units |
-t d2 | decimal, 2 byte unitx |
-t X2 | hex, 2 byte units |
-v | suppress using * for duplicate lines |
Example output:
$od -A x -t x1z -v -N 200 /usr/bin/ls
000000 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 >.ELF............<
000010 03 00 3e 00 01 00 00 00 b0 6a 00 00 00 00 00 00 >..>......j......<
000020 40 00 00 00 00 00 00 00 20 14 02 00 00 00 00 00 >@....... .......<
000030 00 00 00 00 40 00 38 00 0d 00 40 00 1f 00 1e 00 >....@.8...@.....<
000040 06 00 00 00 04 00 00 00 40 00 00 00 00 00 00 00 >........@.......<
000050 40 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 >@.......@.......<
000060 d8 02 00 00 00 00 00 00 d8 02 00 00 00 00 00 00 >................<
000070 08 00 00 00 00 00 00 00 03 00 00 00 04 00 00 00 >................<
000080 18 03 00 00 00 00 00 00 18 03 00 00 00 00 00 00 >................<
000090 18 03 00 00 00 00 00 00 1c 00 00 00 00 00 00 00 >................<
0000a0 1c 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 >................<
0000b0 01 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 >................<
0000c0 00 00 00 00 00 00 00 00 >........<
0000c8
$