Reference

od(1)

octal, decimal, hex, ASCII dump

NAME

od – octal, decimal, hex, ASCII dump

SYNOPSIS

od [-aBbcDdeFfHhIiLlOosvXx] [-A base] [-j skip] [-N length] [-t type] [[+]offset[.][Bb]] [file ...]

DESCRIPTION

The od utility is a filter which displays the specified files, or standard input if no files are specified, in a user specified format.

The options are as follows:

-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 or m which specify the units of the number as blocks (512 bytes), kilobytes and megabytes, 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:

000 NUL001 SOH002 STX003 ETX004 EOT005 ENQ
006 ACK007 BEL008 BS009 HT00A NL00B VT
00C FF00D CR00E SO00F SI010 DLE011 DC1
012 DC2013 DC3014 DC4015 NAK016 SYN017 ETB
018 CAN019 EM01A SUB01B ESC01C FS01D GS
01E RS01F US020 SP07F DEL
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:

NUL

\0

alert

\a

backspace

\b

newline

\n

carriage-return

\r

tab

\t

vertical tab

\v

Multi-byte characters are displayed in the area corresponding to the first byte of the character. The remaining bytes are shown as ‘**’.

[d|o|u|x] [C|S|I|L|n] Signed decimal (d), octal (o), unsigned decimal (u) or hexadecimal (x). Followed by an optional size specifier, which may be either C (char), S (short), I (int), L (long), or a byte count as a decimal integer.

f [F|D|L|n] Floating-point number. Followed by an optional size specifier, which may be either F (float), D (double) or L (long double).

-v

Write all input data, instead of replacing lines of duplicate values with a ‘*’.

Multiple options that specify output format may be used; the output will contain one line for each format.

If no output format is specified, -t oS is assumed.

ENVIRONMENT

The LANG, LC_ALL and LC_CTYPE environment variables affect the execution of od as described in environ(7).

EXIT STATUS

The od utility exits 0 on success, and >0 if an error occurs.

EXAMPLES

Dump stdin and show the output using named characters and C-style escaped characters:

$ echo "FreeBSD: The power to serve" | od -a -c
0000000    F   r   e   e   B   S   D   :  sp   T   h   e  sp   p   o   w
           F   r   e   e   B   S   D   :       T   h   e       p   o   w
0000020    e   r  sp   t   o  sp   s   e   r   v   e  nl
           e   r       t   o       s   e   r   v   e  \n
0000034

Dump stdin skipping the first 13 bytes using named characters and dumping no more than 5 bytes:

$ echo "FreeBSD: The power to serve" | od -An -a -j 13 -N 5
           p   o   w   e   r

COMPATIBILITY

The traditional -s option to extract string constants is not supported; consider using strings(1) instead.

SEE ALSO

hexdump(1), strings(1)

STANDARDS

The od utility conforms to IEEE Std 1003.1-2001 (“POSIX.1”).

HISTORY

An od command appeared in Version 1 AT&T UNIX.

History

-A since FreeBSD 4.7-RELEASE; -B since FreeBSD 4.7-RELEASE; -D since FreeBSD 4.7-RELEASE; -F since FreeBSD 4.7-RELEASE; -H since FreeBSD 4.7-RELEASE; -I since FreeBSD 4.7-RELEASE; -L since FreeBSD 4.7-RELEASE; -N since FreeBSD 4.7-RELEASE; -O since FreeBSD 4.7-RELEASE; -X since FreeBSD 4.7-RELEASE; -a since FreeBSD 4.7-RELEASE; -b since FreeBSD 4.7-RELEASE; -c since FreeBSD 4.7-RELEASE; -d since FreeBSD 7.0-RELEASE; -e since FreeBSD 4.7-RELEASE; -f since FreeBSD 4.7-RELEASE; -h since FreeBSD 4.7-RELEASE; -i since FreeBSD 4.7-RELEASE; -j since FreeBSD 4.7-RELEASE; -l since FreeBSD 4.7-RELEASE; -o since FreeBSD 4.7-RELEASE; -s since FreeBSD 4.7-RELEASE; -t since FreeBSD 4.7-RELEASE; -v since FreeBSD 4.7-RELEASE; -x since FreeBSD 4.7-RELEASE.