OD(1P) POSIX Programmer's Manual OD(1P)
PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond-
ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.
NAME
od -- dump files in various formats
SYNOPSIS
od [-v] [-A address_base] [-j skip] [-N count] [-t type_string]...
[file...]
od [-bcdosx] [file] [[+]offset[.][b]]
DESCRIPTION
The od utility shall write the contents of its input files to standard output in a user-specified format.
OPTIONS
The od utility shall conform to the Base Definitions volume of POSIX.1-2008, Section 12.2, Utility Syntax Guidelines, except that the order
of presentation of the -t options and the -bcdosx options is significant.
The following options shall be supported:
-A address_base
Specify the input offset base. See the EXTENDED DESCRIPTION section. The application shall ensure that the address_base option-
argument is a character. The characters 'd', 'o', and 'x' specify that the offset base shall be written in decimal, octal, or
hexadecimal, respectively. The character 'n' specifies that the offset shall not be written.
-b Interpret bytes in octal. This shall be equivalent to -t o1.
-c Interpret bytes as characters specified by the current setting of the LC_CTYPE category. Certain non-graphic characters appear as
C escapes: "NUL= ", "BS=", "FF=f", "NL=
", "CR=
", "HT= "; others appear as 3-digit octal numbers.
-d Interpret words (two-byte units) in unsigned decimal. This shall be equivalent to -t u2.
-j skip Jump over skip bytes from the beginning of the input. The od utility shall read or seek past the first skip bytes in the concate-
nated input files. If the combined input is not at least skip bytes long, the od utility shall write a diagnostic message to
standard error and exit with a non-zero exit status.
By default, the skip option-argument shall be interpreted as a decimal number. With a leading 0x or 0X, the offset shall be
interpreted as a hexadecimal number; otherwise, with a leading '0', the offset shall be interpreted as an octal number. Appending
the character 'b', 'k', or 'm' to offset shall cause it to be interpreted as a multiple of 512, 1024, or 1048576 bytes, respec-
tively. If the skip number is hexadecimal, any appended 'b' shall be considered to be the final hexadecimal digit.
-N count Format no more than count bytes of input. By default, count shall be interpreted as a decimal number. With a leading 0x or 0X,
count shall be interpreted as a hexadecimal number; otherwise, with a leading '0', it shall be interpreted as an octal number. If
count bytes of input (after successfully skipping, if -j skip is specified) are not available, it shall not be considered an
error; the od utility shall format the input that is available.
-o Interpret words (two-byte units) in octal. This shall be equivalent to -t o2.
-s Interpret words (two-byte units) in signed decimal. This shall be equivalent to -t d2.
-t type_string
Specify one or more output types. See the EXTENDED DESCRIPTION section. The application shall ensure that the type_string option-
argument is a string specifying the types to be used when writing the input data. The string shall consist of the type specifica-
tion characters a, c, d, f, o, u, and x, specifying named character, character, signed decimal, floating point, octal, unsigned
decimal, and hexadecimal, respectively. The type specification characters d, f, o, u, and x can be followed by an optional
unsigned decimal integer that specifies the number of bytes to be transformed by each instance of the output type. The type spec-
ification character f can be followed by an optional F, D, or L indicating that the conversion should be applied to an item of
type float, double, or long double, respectively. The type specification characters d, o, u, and x can be followed by an optional
C, S, I, or L indicating that the conversion should be applied to an item of type char, short, int, or long, respectively. Multi-
ple types can be concatenated within the same type_string and multiple -t options can be specified. Output lines shall be written
for each type specified in the order in which the type specification characters are specified.
-v Write all input data. Without the -v option, any number of groups of output lines, which would be identical to the immediately
preceding group of output lines (except for the byte offsets), shall be replaced with a line containing only an <asterisk> ('*').
-x Interpret words (two-byte units) in hexadecimal. This shall be equivalent to -t x2.
Multiple types can be specified by using multiple -bcdostx options. Output lines are written for each type specified in the order in which
the types are specified.
OPERANDS
The following operands shall be supported:
file A pathname of a file to be read. If no file operands are specified, the standard input shall be used.
If there are no more than two operands, none of the -A, -j, -N, -t, or -v options is specified, and either of the following is
true: the first character of the last operand is a <plus-sign> ('+'), or there are two operands and the first character of the
last operand is numeric; the last operand shall be interpreted as an offset operand on XSI-conformant systems. Under these con-
ditions, the results are unspecified on systems that are not XSI-conformant systems.
[+]offset[.][b]
The offset operand specifies the offset in the file where dumping is to commence. This operand is normally interpreted as octal
bytes. If '.' is appended, the offset shall be interpreted in decimal. If 'b' is appended, the offset shall be interpreted in
units of 512 bytes.
STDIN
The standard input shall be used if no file operands are specified, and shall be used if a file operand is '-' and the implementation
treats the '-' as meaning standard input. Otherwise, the standard input shall not be used. See the INPUT FILES section.
INPUT FILES
The input files can be any file type.
ENVIRONMENT VARIABLES
The following environment variables shall affect the execution of od:
LANG Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of
POSIX.1-2008, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine
the values of locale categories.)
LC_ALL If set to a non-empty string value, override the values of all the other internationalization variables.
LC_CTYPE Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed
to multi-byte characters in arguments and input files).
LC_MESSAGES
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
LC_NUMERIC
Determine the locale for selecting the radix character used when writing floating-point formatted output.
NLSPATH Determine the location of message catalogs for the processing of LC_MESSAGES.
ASYNCHRONOUS EVENTS
Default.
STDOUT
See the EXTENDED DESCRIPTION section.
STDERR
The standard error shall be used only for diagnostic messages.
OUTPUT FILES
None.
EXTENDED DESCRIPTION
The od utility shall copy sequentially each input file to standard output, transforming the input data according to the output types speci-
fied by the -t option or the -bcdosx options. If no output type is specified, the default output shall be as if -t oS had been specified.
The number of bytes transformed by the output type specifier c may be variable depending on the LC_CTYPE category.
The default number of bytes transformed by output type specifiers d, f, o, u, and x corresponds to the various C-language types as follows.
If the c99 compiler is present on the system, these specifiers shall correspond to the sizes used by default in that compiler. Otherwise,
these sizes may vary among systems that conform to POSIX.1-2008.
* For the type specifier characters d, o, u, and x, the default number of bytes shall correspond to the size of the underlying implemen-
tation's basic integer type. For these specifier characters, the implementation shall support values of the optional number of bytes to
be converted corresponding to the number of bytes in the C-language types char, short, int, and long. These numbers can also be speci-
fied by an application as the characters 'C', 'S', 'I', and 'L', respectively. The implementation shall also support the values 1, 2,
4, and 8, even if it provides no C-Language types of those sizes. The implementation shall support the decimal value corresponding to
the C-language type long long. The byte order used when interpreting numeric values is implementation-defined, but shall correspond to
the order in which a constant of the corresponding type is stored in memory on the system.
* For the type specifier character f, the default number of bytes shall correspond to the number of bytes in the underlying implementa-
tion's basic double precision floating-point data type. The implementation shall support values of the optional number of bytes to be
converted corresponding to the number of bytes in the C-language types float, double, and long double. These numbers can also be spec-
ified by an application as the characters 'F', 'D', and 'L', respectively.
The type specifier character a specifies that bytes shall be interpreted as named characters from the International Reference Version (IRV)
of the ISO/IEC 646:1991 standard. Only the least significant seven bits of each byte shall be used for this type specification. Bytes with
the values listed in the following table shall be written using the corresponding names for those characters.
Table: Named Characters in od
+-------------+--------------+-------------------+--------------+
|Value Name | Value Name | Value Name | Value Name |
+-------------+--------------+-------------------+--------------+
| 00 nul | 01 soh | 02 stx | 03 etx |
| 04 eot | 05 enq | 06 ack | 07 bel |
| 10 bs | 11 ht | 12 lf or nl* | 13 vt |
| 14 ff | 15 cr | 16 so | 17 si |
| 20 dle | 21 dc1 | 22 dc2 | 23 dc3 |
| 24 dc4 | 25 nak | 26 syn | 27 etb |
| 30 can | 31 em | 32 sub | 33 esc |
| 34 fs | 35 gs | 36 rs | 37 us |
| 40 sp | 177 del | | |
+-------------+--------------+-------------------+--------------+
Note: The "