od
is a command that dumps binary files to eight digits.
Option | Description |
---|---|
-A base | Specify the input address base. The argument base may be one of d, o, x or n, which specify decimal, octal, hexadecimal addresses or no address, respectively. |
-a | Output named characters. Equivalent to -t a . |
-B, -o | Output octal shorts. Equivalent to -t o2 . |
-b | Output octal bytes. Equivalent to -t o1 . |
-c | Output C-style escaped characters. Equivalent to -t c . |
-D | Output unsigned decimal ints. Equivalent to -t u4 . |
-d | Output unsigned decimal shorts. Equivalent to -t u2 . |
-e, -F | Output double-precision floating point numbers. Equivalent to -t fD . |
-f | Output single-precision floating point numbers. Equivalent to -t fF . |
-H, -X | Output hexadecimal ints. Equivalent to -t x4 . |
-h, -x | Output hexadecimal shorts. Equivalent to -t x2 . |
-I, -L, -l | Output signed decimal longs. Equivalent to -t dL . |
-i | Output signed decimal ints. Equivalent to -t dI . |
-j skip | Skip skip bytes of the combined input before dumping. The number may be followed by one of b, k, m or g which specify the units of the number as blocks (512 bytes), kilobytes, megabytes and gigabytes, respectively. |
-N length | Dump at most length bytes of input. |
-O | Output octal ints. Equivalent to -t o4 . |
-s | Output signed decimal shorts. Equivalent to -t d2 . |
-t type | Specify the output format. The type argument is a string containing one or more of the following kinds of type specifiers. |
a | Named characters (ASCII). Control characters are displayed using the following names: |
c | Characters in the default character set. Non-printing characters are represented as 3-digit octal character codes, except the following characters, which are represented as C escapes like \0 , \n , \t , so on. Multi-byte characters are displayed in the area corresponding to the first byte of the character. The remaining bytes are shown as ‘**’. |
[d | o |
f[F | D |
-v | Write all input data, instead of replacing lines of duplicate values with a ‘*’. |
Example
File test
’s content is:
od -t x1 test
-> Express the test file by 1 byte in hexadecimal.
od -t x1z test
-> Express 1 byte by hexadecimal and display ASCII characters on the below.
od -Ad test
-> Print as demical.
reference