od(1) od(1)
NAME
od - dump contents of a file in various formats
SYNOPSIS
od [-v] [-A format] [-j number] [-N number] [-t format ...]\
[--] [file ...] Format 1
od [option ...] [file] [[+]offset[.][b]] Format 2
DESCRIPTION
The od command dumps (i.e. writes the contents of) a file on the stan-
dard output in an output format that you select with command-line
options.
The first column of each output line specifies the position of the
first character in this line. Characters can be specified in octal,
decimal or hexadecimal, depending on the indicated output format.
OPTIONS
Format 1: New synopsis for od
No option specified:
Each group of 2 bytes is interpreted as an unsigned octal number
(same as option -t o2).
-A format
Defines the format for the positioning specification in the first
column of each line of output. format can assume the following
values:
d Decimal positioning specification
o Octal positioning specification
x Hexadecimal positioning specification
n No positioning specification
-j number
Defines the position in the file at which output is to begin.
number specifies how many bytes are to be skipped at the begin-
ning. Multiple files are handled as if joined together in a sin-
gle file.
number is interpreted as a decimal number by default. This format
can be varied by means of additional specifications:
0xnumber or 0Xnumber
number is interpreted as a hexadecimal number
0number
number is interpreted as an octal number
Page 1 Reliant UNIX 5.44 Printed 11/98
od(1) od(1)
numberb
number is interpreted as a multiple of 512 bytes (cannot be
combined with 0x, as b is interpreted as part of the hexade-
cimal number in this case)
numberk
number is interpreted as a multiple of 1024 bytes
numberm
number is interpreted as a multiple of 1024x1024 bytes
-N number
od outputs a maximum of number bytes.
number is interpreted as a decimal number by default. This format
can be varied by specifying 0x, 0X, or 0 before number:
0xnumber or 0Xnumber
number is interpreted as a hexadecimal number
0number
number is interpreted as an octal number
-t format
Defines the output format. You can specify a number of output
formats or options -t. The lines are output in the sequence of
the specified output formats or -t options.
format can assume the following values:
a Output as characters; names in accordance with ISO/IEC 646
are output instead of control characters [see ascii(5)]:
Page 2 Reliant UNIX 5.44 Printed 11/98
od(1) od(1)
__________________________________________________
| Oct. | Name | Meaning |
|______|___________|______________________________|
| \000 | nul | Null |
|______|___________|______________________________|
| \001 | soh | Start of Heading |
|______|___________|______________________________|
| \002 | stx | Start of Text |
|______|___________|______________________________|
| \003 | etx | End of Text |
|______|___________|______________________________|
| \004 | eot | End of Transmission |
|______|___________|______________________________|
| \005 | enq | Enquiry |
|______|___________|______________________________|
| \006 | ack | Acknowledge |
|______|___________|______________________________|
| \007 | bel | Bell |
|______|___________|______________________________|
| \010 | bs | Backspace |
|______|___________|______________________________|
| \011 | ht | Horizontal Tabulation |
|______|___________|______________________________|
| \012 | lf or nl | Line Feed |
|______|___________|______________________________|
| \013 | vt | Vertical Tabulation |
|______|___________|______________________________|
| \014 | ff | Form Feed |
|______|___________|______________________________|
| \015 | cr | Carriage Return |
|______|___________|______________________________|
| \016 | so | Shift Out |
|______|___________|______________________________|
| \017 | si | Shift In |
|______|___________|______________________________|
| \020 | dle | Data Link Escape |
|______|___________|______________________________|
| \021 | dc1 | Device Control 1 |
|______|___________|______________________________|
| \022 | dc2 | Device Control 2 |
|______|___________|______________________________|
| \023 | dc3 | Device Control 3 |
|______|___________|______________________________|
| \024 | dc4 | Device Control 4 |
|______|___________|______________________________|
| \025 | nak | Negative Acknowledge |
|______|___________|______________________________|
| \026 | syn | Synchronous Idle |
|______|___________|______________________________|
| \027 | etb | End of Transmission Block |
|______|___________|______________________________|
Page 3 Reliant UNIX 5.44 Printed 11/98
od(1) od(1)
__________________________________________________
| Oct. | Name | Meaning |
|______|___________|______________________________|
| \030 | can | Cancel |
|______|___________|______________________________|
| \031 | em | End of Medium |
|______|___________|______________________________|
| \032 | sub | Substitute Character |
|______|___________|______________________________|
| \033 | esc | Escape |
|______|___________|______________________________|
| \034 | fs | File Separator |
|______|___________|______________________________|
| \035 | gs | Group Separator |
|______|___________|______________________________|
| \036 | rs | Record Separator |
|______|___________|______________________________|
| \037 | us | Unit Separator |
|______|___________|______________________________|
| \040 | sp | Space |
|______|___________|______________________________|
| \177 | del | Delete |
|______|___________|______________________________|
c Output as characters; some control characters are repre-
sented as escape sequences:
___________________________________
| Null byte (all bits are 0)| \0 |
|___________________________|______|
| Warning, alert | \a |
|___________________________|______|
| Backspace | \b |
|___________________________|______|
| Form feed | \f |
|___________________________|______|
| Newline character | \n |
|___________________________|______|
| Carriage return | \r |
|___________________________|______|
| Horizontal tabs | \t |
|___________________________|______|
| Vertical tabs | \v |
|___________________________|______|
The remaining non-printing characters are output as three-
digit octal numbers [see meta-ascii(5)].
The number of bytes that are interpreted as a single charac-
ter depends on the internationalized environment.
Page 4 Reliant UNIX 5.44 Printed 11/98
od(1) od(1)
d Signed decimal number
f Floating point number
o Octal number
u Unsigned decimal number
x Hexadecimal number
For the formats d, f, o, u, and x you can define how many bytes
are to be considered as a single unit. To do this you specify a
number after the format letter, e.g. -t o2.
The floating point number type (f) is defined by entering one of
the following letters:
F Floating point number of type float
D Floating point number of type double
L Floating point number of type long double
The other numeric representation types (d, o, u, x) are defined
by specifying one of the following letters:
C Number of type char
S Number of type short
I Number of type int
L Number of type long
-t not specified:
Each group of 2 bytes is interpreted as an unsigned octal number
(same as option -t o2).
-v (v - verbose) All data is displayed.
-v not specified:
Any number of lines that are identical with the previous line are
replaced by an asterisk (*).
-- End of the list of options. Must be specified if file begins with
-.
Page 5 Reliant UNIX 5.44 Printed 11/98
od(1) od(1)
file Name of the file to be output. Several files can be specified.
file not specified: od reads from the standard input.
Warning: If no options are specified and file begins with a digit
or +, it is interpreted as offset in accordance with the old
synopsis for od.
Format 2: Old synopsis for od
In previous versions of od, only this format was available. It is
still supported, but should not be used by portable applications.
If you specify several options in order to combine various output for-
mats, the dash - must only be specified once, followed by the option
names without blanks, e.g. od -bcs file. The lines are output in
accordance with the sequence of options.
No option specified
Each group of 2 bytes is interpreted as an unsigned octal number
(same as option -o).
-b Interprets each byte as an octal number. (Corresponds to the -t
o1 option in the new synopsis).
-c Bytes are interpreted as characters. The number of bytes that are
interpreted as a single character depends on the international-
ized environment. Certain non-printing characters appear as the C
escapes shown below:
___________________________________
| Null byte (all bits are 0)| \0 |
|___________________________|______|
| Warning, alert | \a |
|___________________________|______|
| Backspace | \b |
|___________________________|______|
| Form feed | \f |
|___________________________|______|
| Newline | \n |
|___________________________|______|
| Carriage return | \r |
|___________________________|______|
| Horizontal tabs | \t |
|___________________________|______|
| Vertical tabs | \v |
|___________________________|______|
The other non-graphic characters appear as 3-digit octal numbers
[see meta-ascii(5)]. (Corresponds to the -t c option in the new
synopsis).
Page 6 Reliant UNIX 5.44 Printed 11/98
od(1) od(1)
-d Interprets each group of 2 bytes as an unsigned decimal number.
(Corresponds to the -t u2 option in the new synopsis).
-D Interprets each group of 4 bytes as an unsigned decimal number.
(Corresponds to the -t u4 option in the new synopsis).
-f Interprets each group of 4 bytes as a floating point number.
(Corresponds to the -t f4 option in the new synopsis).
-F Interprets each group of 8 bytes as an extended precision number.
(Corresponds to the -t f8 option in the new synopsis).
-o Interprets each group of 2 bytes as an unsigned octal number.
(Corresponds to the -t o2 option in the new synopsis).
-O Interprets each group of 4 bytes as an unsigned octal number.
(Corresponds to the -t o4 option in the new synopsis).
-s Interprets each group of 2 bytes as an signed decimal number.
(Corresponds to the -t d2 option in the new synopsis).
-S Interprets each group of 4 bytes as an signed decimal number.
(Corresponds to the -t d4 option in the new synopsis).
-v (verbose) Shows all data.
-v not specified:
Any number lines that are identical to the previous line are
replaced by an asterisk (*).
-x Interprets each group of 2 bytes as an unsigned hexadecimal
number. (Corresponds to the -t x2 option in the new synopsis).
-X Interprets each group of 4 bytes as an unsigned hexadecimal
number. (Corresponds to the -t x4 option in the new synopsis).
-- If file begins with a dash (-), the end of the command line
options must be marked with --.
file Name of the file to be dumped.
file not specified: od reads from standard input.
[+]offset[.][b]
The offset argument specifies the offset in the file where dumping
is to commence. (Corresponds to the -j option in the new synopsis).
offset is normally interpreted in octal bytes. If a period (.) is
appended to the offset argument, the offset is interpreted in
decimal. If b is appended, the offset is interpreted in blocks of
512 bytes.
Page 7 Reliant UNIX 5.44 Printed 11/98
od(1) od(1)
If the file argument is omitted, the offset argument must be pre-
ceded by a plus sign (+) to prevent it from being interpreted as
a file name.
offset not specified:
Dumping commences at the start of the file.
LOCALE
The LCMESSAGES environment variable governs the language in which
message texts are displayed. If CMESSAGES is undefined or is defined
as the null string, it defaults to the value of LANG. If LANG is like-
wise undefined or null, the system acts as if it were not internation-
alized.
The LCALL environment variable governs the entire locale. LCALL
takes precedence over all the other environment variables which affect
internationalization.
EXAMPLES
Example 1
Unsigned octal dump of the contents of file text:
$ cat text
Keep a stiff upper lip.
$ od text
0000000 062513 070145 060440 071440 064564 063146 072440 070160
0000020 071145 066040 070151 005056
0000030
Example 2
Display the contents of the file text in octal form and as ASCII char-
acters from the sixth byte onward:
$ od -j 5 -t o1 -t c text
0000005 141 040 163 164 151 146 146 040 165 160 160 145 162 040 154
a s t i f f u p p e r l
0000021 151 160 056 012 000
i p . \n \0
0000024
SEE ALSO
sed(1), ascii(5), meta-ascii(5).
Page 8 Reliant UNIX 5.44 Printed 11/98