Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

locale(4)

od(1)  —  Commands

NAME

od − Writes the contents of a file to standard output

SYNOPSIS

od [-v] [-Q] [-A address_base] [-j skip] [-N count] [-t type_string...] [file ...]

od [-abBcCdDefFhHiIlLoOpPSvxX] [-A address_base] [-j skip] [-N count] [-t type_string...] [-s[number]] [-wnumber] [file ...] [+] [offset] [.][b | B] [label][.][b | B]

The od command reads file (standard input by default), and writes the information stored in file to standard output using the format specified by the first flag.  If you do not specify the first flag, the -o flag is the default. 

FLAGS

Format characters are as follows:

-QDisplays quadwords as hexadecimal values. This option applies only to the operating system for Alpha AXP systems. 

-aDisplays bytes as characters and displays them with their ASCII names.  If the p character is also given, bytes with even parity are underlined.  The P character causes bytes with odd parity to be underlined.  Otherwise, parity is ignored. 

-A address_base
Specifies the input offset base with the single-character address_base argument.  The characters d, o, and x specify that the offset base be written in decimal, octal, or hexadecimal, respectively.  The character n specifies that the offset not be written at all. 

-bDisplays bytes as octal values. 

-BDisplays short words as octal values. 

-cDisplays bytes as characters using the current setting of the LC_CTYPE variable.  The following nongraphic characters appear as C escape sequences:

\0Null

\aAlarm (or bell)

\bBackspace

\fFormfeed

\nNewline character

\rEnter

\tTab

\vVertical tab

Other nongraphic characters appear as 3-digit octal numbers.  Bytes with the parity bit set are displayed in octal. 

-CDisplays any extended characters as standard printable ASCII characters using the appropriate character escape string. 

-dDisplays short words as unsigned decimal values. 

-DDisplays long words as unsigned decimal values. 

-eDisplays long words as double-precision, floating-point.  (Same as -F.) 

-fDisplays long words as single-precision, floating-point. 

-FDisplays long words as double-precision, floating-point. 

-hDisplays short words as unsigned hexadecimal values. 

-HDisplays long words as unsigned hexadecimal values. 

-iDisplays short words as signed decimal values. 

-I, -l, -LDisplay long words as signed decimal values.  (The three flags are identical.) 

-j skipJumps over (reading or seeking) skip bytes from the beginning of the concatenated input files.  If the input is not at least skip bytes long, od writes a diagnostic message to standard error and returns a nonzero exit value. 

The skip argument is interpreted as a decimal number by default.  If you include a leading offset of 0x or 0X, skip is interpreted as a hexadecimal number.  A leading offset of 0 (zero) causes skip to be interpreted as an octal number. 

If you append the character b, k, or m to skip, the number is interpreted as a multiple of 512, 1024, or 1,048,576 bytes, respectively. 

-N count
Causes od to format no more than count bytes of input. 

The count argument is interpreted as a decimal number by default.  If you include a leading offset of 0x or 0X, count is interpreted as a hexadecimal number.  A leading offset of 0 (zero) causes count to be interpreted as an octal number.  If there are not count bytes of input available (after successfully skipping bytes as specified by -j), od formats the available input. 

-oDisplays short words as octal values. 

-ODisplays long words as unsigned octal values. 

-pIndicates even parity on -a conversion. 

-PIndicates odd parity on -a conversion. 

-s[number]
Looks for strings of ASCII graphic characters, terminated with a null byte. The number argument specifies the minimum length string to be recognized. By default, the minimum length is 3 characters.  Allowable characters are those between blank (040) and tilde (0176), as well as backspace, tab, linefeed, formfeed, and carriage-return (010 through 015, except 013). 

-sIf the environment variable CMD_ENV is set to svr4, displays signed words (32-bit or DEC OSF/1 short words) as signed decimal values. 

-SDisplays long words as signed decimal values. 

-t type_string...
Specifies one or more output types.  The type_string argument is a string that specifies the types to be used when writing the input data.  type_string consists of the following type specification characters:

aNamed character

cCharacter

dSigned decimal

fFloating point

oOctal

uUnsigned decimal

xHexadecimal

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 specification character f can be followed by one of the following optional characters, which indicate the type of the item to which the conversion should be applied. 

Ffloat

Ddouble

Llong double

The type specification characters d, o, u, and x can be followed by one of the following optional characters, which indicate the type of the item to which the conversion should be applied:

Cchar

Iint

Llong

Sshort

You can concatenate multiple types within the same type_string argument and you can specify multiple -t arguments. The od command writes the output lines for each type specified in the order in which you entered the type specification characters. 

-vShows all data.  By default, display lines that are identical to the previous line are not output (except for the byte offsets), but are indicated with an ∗ (asterisk) in column 1. 

-w[number]
Specifies the number of input bytes to be interpreted and displayed on each output line.  If -w is not specified, 16 bytes are read for each display line.  If number is not specified, it defaults to 32. 

-xDisplays short words as unsigned hexadecimal values.  (Same as -h.) 

-XDisplays long words as unsigned hexadecimal values.  (Same as -H.) 

An uppercase format character implies the long or double-precision form of the object. 

The offset argument specifies the point in the file at which the output starts.  The offset argument is interpreted as octal bytes.  If a . (dot) is added to offset, it is interpreted in decimal.  If offset begins with x or 0x, it is interpreted in hexadecimal.  If b (B) is appended, the offset is interpreted as a block count, where a block is 512 (1024) bytes. 

The label argument is interpreted as a pseudoaddress for the first byte displayed.  It is shown in parentheses following the file offset.  It is intended to be used with core images to indicate the real memory address.  The syntax for label is identical to that for offset. 

The output continues until the end of the file. 

DESCRIPTION

When od reads standard input, the offset and label parameters must be preceded by a + (plus sign). 

If you omit the file argument and do not specify -A, -j, -N, or -t, you must precede the offset argument by a + (plus sign) character. 

If the first character of file is a + (plus sign) or the first character of the first file argument is numeric, you give no more than two arguments, and specify none of the -A, -j, -N, or -t flags, od assumes the argument to be an offset. 

If you omit the file argument and specify none of the -A, -j, -N, or -t flags, you must precede the offset argument by a + (plus sign) character. 

To be sure that od assumes the argument to be an offset:

       •Make the first character of file a + sign, or the first character of the first file argument numeric. 

       •Give no more than two arguments. 

       •Specify none of the -A, -j, -N, or -t flags. 

EXAMPLES

     1.To display a file in octal word format, a page at a time, enter:

od  a.out | more

     2.To translate a file into several formats at once, enter:

od  -cx  a.out  >a.xcd

This writes a.out in hexadecimal format (the -x flag) into the file a.xcd, giving also the ASCII character equivalent, if any, of each byte (the -c flag). 

     3.To start in the middle of a file, enter:

od  -bcx  a.out  +100.

This displays a.out in octal-byte, character, and hexadecimal formats, starting from the 100th byte.  The . (dot) after the offset makes it a decimal number.  Without the . (dot), the dump starts from the 64th (100 octal) byte. 

Compatibility Note

The -i flag displays short words as signed decimal values.  The -i flag used to be -s in System V. 

RELATED INFORMATION

Files:  locale(4). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026