Displays files in a specified format.
To Display Files Using a Type-String to Format the Output
od [ -v ] [ -A AddressBase ] [ -N Count ] [ -j Skip ] [ -t TypeString ... ] [ File ... ]
To Display Files Using Flags to Format the Output
od [ -a ] [ -b ] [ -c ] [ -C ] [ -d ] [ -D ] [ -e ] [ -f ] [ -F ] [ -h ] [ -H ] [ -i ] [ -I ] [ -l ] [ -L ] [ -o ] [ -O ] [ -p ] [ -P ] [ -s ] [ -v ] [ -x ] [ -X ] [ [ -S [ N ] ] [ -w [ N ] ] [ File ] [ [ + ] Offset [ . | b | B ] [ + ] Label [ . | b | B ] ] [ File ... ]
The od command displays the file specified by the File parameter in the format specified. If the File parameter is not given, the od command reads standard input. Multiple types can be specified by using multiple -bcCDdFfOoSstvXx options.
In the first syntax format, the output format is specified by the -t flag. If no format type is specified, -t o2 is the default.
In the second syntax format, the output format is specified by a combination of flags. The Offset parameter specifies the point in the file where the file output begins. By default, the Offset parameter is interpreted as octal bytes. If the . (dot) suffix is appended, the parameter is interpreted as a decimal; if the parameter begins with a leading x or 0x, it is treated as a hexadecimal. If the b suffix is added to the parameter, it is interpreted in blocks of 512 bytes; if the B suffix is added to the parameter, it is interpreted in blocks of 1024 bytes.
The Label parameter is interpreted as a pseudo-address for the first byte displayed. If used, it is given in ( ) (parentheses) following the Offset parameter. The suffixes have the same meanings as for the Offset parameter.
When the od command reads standard input, the Offset parameter and the Label parameter must be preceded by a + (plus sign).
The setting of environment variables such as LANG and LC_ALL affects the operation of the od command. See "Understanding Locale Environment Variables" in AIX® Version 7.1 Operating system and device management for more information.
The flags for the first format are:
Item | Description |
---|---|
-A AddressBase | Specifies the input offset base. The AddressBase variable
is one of the following characters:
Unless -A n is specified, the output line will be preceded by the input offset, cumulative across input files, of the next byte to be written. In addition, the offset of the byte following the last byte written will be displayed after all the input data has been processed. Without the -A address_base option and the [offset_string] operand, the input offset base is displayed in octal. |
-j Skip | Jumps over the number of bytes given by the Skip variable before beginning to display output. If more than one file is specified, the od command jumps over the designated number of bytes of the concatenated input files before displaying output. If the combined input is not at least the length of the skip bytes, the od command will write a diagnostic message to standard error and exit non-zero status. By default, the value of the Skip variable is interpreted as a decimal number. With a leading 0x or 0X, the offset is interpreted as a hexadecimal number; otherwise, with a leading 0, the offset shall be interpreted as an octal number. If the characters b, k, or m are appended to the number contained by the Skip variable, the offset is equal to the value, in bytes, of the Skip variable multiplied by 512, 1024, or 1024*1024, respectively. |
-N Count | Formats no more than the number of input bytes specified by the Count variable. By default, the value of the Count variable is interpreted as a decimal number. With a leading 0x or 0X, it is treated as a hexadecimal number. If it begins with a 0, it is treated as an octal number. The base of the address displayed is not implied by the base of the Count option-argument. |
-t TypeString | Specifies the output type. The TypeString variable
is a string specifying the types to be used when writing out data.
Multiple types can be concatenated within the same TypeString variable,
and the -t flag can be specified more than once. Output lines
are written for each type specified, in the order in which the type
specification characters are given. The TypeString variable
can consist of the following characters:
|
|
|
|
|
|
The flags for the second format are:
Item | Description |
---|---|
-a | Displays bytes as characters and displays them with their ASCII names. If the -p flag is also given, bytes with even parity are underlined. The -P flag causes bytes with odd parity to be underlined. Otherwise, parity is ignored. |
-b | Displays bytes as octal values. |
-c | Displays bytes as ASCII characters. The following nongraphic
characters appear as C-language escape sequences:
Others appear as three-digit octal numbers. |
-C | Displays extended characters as standard printable ASCII characters (using the appropriate character escape string) and displays multibyte characters in hexadecimal form. |
-d | Displays 16-bit words as unsigned decimal values. |
-D | Displays long words as unsigned decimal values. |
-e | Displays long words as double-precision, floating point. (same as the -F flag) |
-f | Displays long words as floating points. |
-F | Displays long words as double-precision, floating point. (same as the -e flag) |
-h | Displays 16-bit words as unsigned hexadecimal. |
-H | Displays long words as unsigned hexadecimal values. |
-i | Displays 16-bit words as signed decimal. |
-I | (Uppercase i) Displays long words as signed decimal values. |
-l | (Lowercase L) Displays long words as signed decimal values. |
-L | Displays long words as signed decimal values. |
Note: The flags -I (uppercase i), -l (lowercase L), and -L are identical.
Item | Description |
---|---|
-o | Displays 16-bit words as unsigned octal. |
-O | Displays long words as unsigned octal values. |
-p | Indicates even parity on -a conversion. |
-P | Indicates odd parity on -a conversion. |
-s | Displays 16-bit words as signed decimal values. |
-S[N] | Searches for strings of characters ending with a null byte. The N variable specifies the minimum length string to be recognized. If the N variable is omitted, the minimum length defaults to 3 characters. |
The -v flag is the same for both formats:
Item | Description |
---|---|
-v | Writes all input data. By default, output lines that are identical to the immediately preceding output lines are not printed, but are replaced with a line containing only an * (asterisk). When the -v flag is specified, all the lines are printed. |
-w [N] | Specifies the number of input bytes to be interpreted and displayed on each output line. If the -w flag is not specified, 16 bytes are read for each display line. If the -w flag is specified without the N variable, 32 bytes are read for each display line. The maximum input value is 4096 bytes. Input values greater than 4096 bytes will be reassigned the maximum value. |
-x | Displays 16-bit words as hexadecimal values. |
-X | Displays long words as unsigned hexadecimal values. (same as the -H flag) |
This command returns the following exit values:
Item | Description |
---|---|
0 | All input files were processed successfully. |
>0 | An error occurred. |
od a.out | pg
This
command displays the a.out file in octal format and pipes
the output through the pg command.Item | Description |
---|---|
/usr/bin/od | Contains the od command. |