Dump a file in various formats (POSIX)
od [-v] [-A format] [-t fmtstr] [-N count] [-j skip] [file]...
QNX Neutrino, Microsoft Windows
The default is o.
The default format is oS.
Use the od utility to display a file in various forms, including decimal, hex, octal, and ASCII. The name “od” (octal dump) is derived from the default output format.
The od utility processes input in 16-byte units that are formatted into a line. In the default output format:
For example:
$ echo "abcdefghijklmnopqrstuvwxyz01234" | od 0000000000 14430661141 15031663145 15432665151 16033667155 0000000020 16434671161 17035673165 06114075171 01215031462 0000000040
To exclude part of the input, use the -N and -j options. You can specify the arguments to these options in hex (using a 0x prefix) or octal (using a 0 prefix). The default units for these options are bytes, but you can specify different units as follows:
To specify: | Add this suffix: |
---|---|
Blocks (512 bytes) | b |
Kilobytes (1024 bytes) | k |
Megabytes (1048576 bytes) | m |
To specify the output format, use the -t option. The format argument — which you can specify in decimal, hex, or octal — tells od which format to use for presenting the output:
ASCII mnemonic | Value | Representation |
---|---|---|
NUL | 00 | \0 |
<alert> | 07 | \a |
<backspace> | 08 | \b |
<tab> | 09 | \t |
<newline> | 0a | \n |
<vertical tab> | 0b | \v |
<formfeed> | 0c | \f |
<carriage return> | 0d | \r |
The input, processed in 16-byte units formatted into a line, is displayed according to the size you choose:
To display input as: | Choose: |
---|---|
Sixteen 1-byte objects | 1 |
Eight 2-byte objects | 2 |
Four 4-byte values per line | 4 |
Two 8-byte values per line | 8 |
char | C |
double | D |
float | F |
int | I |
long or long double (depending on the format) | L |
short | S |
Display the second to eleventh sectors of the hard disk, /dev/hd0:
od -j 1b -N 10b /dev/hd0