DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

od(1)


od -- dump files in various formats

Synopsis

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

od [-bcDdFfOoSsvXx] [file] [[+]offset][. | b | x]

Description

In the first synopsis line, od displays file in one or more formats, as selected by type_string. If the -t option is missing, octal output (-t o2) is the default. If no file is specified, the standard input is used. Multiple file arguments are concatenated into a single long file. Address offsets, including those used with -A and -N, accumulate across the files.

In the second synopsis line, od displays file in one or more formats, as selected by the first argument. If the first argument is missing -o is default. If no file is specified, the standard input is used.

od processes supplementary code set characters according to the locale specified in the LC_CTYPE environment variable (see LANG on environ(5)).

Command options


-A address_base
The base of the offset address written at the start of all output lines is set by address_base. The meaning of the character address_base is:

d
Use decimal base

o
Use octal base

x
Use hexadecimal base

n
Don't write the offset address

-j skip
Jump over skip bytes from the start of the input. If the value of skip is greater than the combined length of the input files, an error is generated.

The skip argument is normally interpreted as a positive decimal integer. However, if the number is preceded by 0x or 0X it is interpreted as a hexadecimal number, otherwise if it is preceded by 0 it is interpreted as an octal number. Also, if one of the characters ``b'', ``k'', or ``m'' is the final character in skip, the offset is interpreted as a multiple of 512, 1024, or 1048576 bytes, respectively.


-N count
Process only count bytes of the input files. If the value of count plus skip (if present) is greater than the combined length of the input files, an error is generated.

The count argument is normally interpreted as a positive decimal integer. However, if the number is preceded by 0x or 0X it is interpreted as a hexadecimal number, otherwise if it is preceded by 0 is interpreted as an octal number.


-t type_string
The type_string is a sequence of output format specifiers that each specify the display format of a corresponding line in the output. So, if three specifiers are given, each input line will be written three times, in the three specified formats. The specifiers in type_string have no separators.

Each specifier consists of a type specification character possibly followed by a further qualifier. The choices of type specification character are:


a
Named Character

c
Character

d
Signed Decimal

f
Floating Point

o
Octal

u
Unsigned Decimal

x
Hexadecimal

The d, f, o, u, and x type specifiers can be optionally followed by a positive decimal integer, which gives the size of that data type in bytes for this specification. The d, o, u, and x type specifiers can replace the integer with one of the following qualifier characters:

Type qualifier Equivalent C language type
C char
S short
I int
L long

 Type qualifier   Equivalent C language type
 C                char
 S                short
 I                int
 L                long

In the same way, the f type specification may replace the integer with one of the following qualifier characters:

Type qualifier Equivalent C language type
F float
D double
L long double

 Type qualifier   Equivalent C language type
 F                float
 D                double
 L                long double

See ``Output format'' for more details on each type's output format.


-v
Write all input data. If -v is not specified, sequences of lines that would all be identical but for the offset address are abbreviated to a single asterisk (*) on a single line.

Output format

Each type specifier can produce a variety of formats, described below.

a
The a type specifier only examines the least significant seven bits of each byte in the input. If the result is a printable character, then that character is printed, otherwise one of the names in the table below is printed.

Value Name Value Name Value Name Value Name
\000 (nul) \001 (soh) \002 (stx) \003 (etx)
\004 (eot) \005 (enq) \006 (ack) \007 (bel)
\010 (bs) \011 (ht) \012 (nl) \013 (vt)
\014 (ff) \015 (cr) \016 (so) \017 (si)
\020 (dle) \021 (dcl) \022 (dc2) \023 (dc3)
\024 (dc4) \025 (nak) \026 (syn) \027 (etb)
\030 (can) \031 (em) \032 (sub) \033 (esc)
\034 (fs) \035 (gs) \036 (rs) \037 (us)
\040 (sp) \177 (del)        

 Value   Name    Value   Name    Value   Name    Value   Name
 \000    (nul)   \001    (soh)   \002    (stx)   \003    (etx)
 \004    (eot)   \005    (enq)   \006    (ack)   \007    (bel)
 \010    (bs)    \011    (ht)    \012    (nl)    \013    (vt)
 \014    (ff)    \015    (cr)    \016    (so)    \017    (si)
 \020    (dle)   \021    (dcl)   \022    (dc2)   \023    (dc3)
 \024    (dc4)   \025    (nak)   \026    (syn)   \027    (etb)
 \030    (can)   \031    (em)    \032    (sub)   \033    (esc)
 \034    (fs)    \035    (gs)    \036    (rs)    \037    (us)
 \040    (sp)    \177    (del)

c
Bytes are interpreted as characters according to the current locale specified in LC_CTYPE (see LANG on environ(5)). Printable single-byte characters are printed as usual. Printable multibyte characters are written in the position of the first byte of the character, with all further byte positions filled with ``**''. Certain non-printable characters appear as C-language escapes:

Character Escape sequence
null \0
alert \a
backspace \b
formfeed \f
newline \n
return \r
tab \t
vertical tab \v

 Character      Escape sequence
 null           \0
 alert          \a
 backspace      \b
 formfeed       \f
 newline        \n
 return         \r
 tab            \t
 vertical tab   \v

All other non-printable characters appear as a sequence of 3-digit octal numbers, one for each byte. See ``Examples''.


d f o u x
The qualifiers for these type specifiers correspond in size to the C language data types of the same names, for the particular architecture that od is running on.

Compatibility options

The following options are supported for compatibility. For the purposes of this description, word refers to a 16-bit unit, independent of the word size of the machine; long word refers to a 32-bit unit, and double long word refers to a 64-bit unit.

-b
Interpret bytes in octal.

-c
Interpret bytes as single-byte characters. Multibyte characters are treated as non-graphic characters. Certain non-graphic characters appear as C-language escapes: null=``\0'', backspace=``\b'', form-feed=``\f'', new-line=``\n'', return=``\r'', tab=``\t''; others appear as 3-digit octal numbers. For example:
echo "hello world" | od -c
0000000   h   e   l   l   o       w   o   r   l   d  \n
0000014

-D
Interpret long words in unsigned decimal.

-d
Interpret words in unsigned decimal.

-F
Interpret double long words in extended precision.

-f
Interpret long words in floating point.

-O
Interpret long words in unsigned octal.

-o
Interpret words in octal.

-S
Interpret long words in signed decimal.

-s
Interpret words in signed decimal.

-v
Show all data (verbose)

-X
Interpret long words in hex.

-x
Interpret words in hex.

offset specifies an offset from the beginning of file where the display will begin. offset is normally interpreted as octal bytes. If ``.'' is appended, offset is interpreted in decimal. If ``x'' is appended, offset is interpreted in hexadecimal. If offset is omitted, the ``.'' and ``x'' can still be used to display decimal and hexadecimal addresses, respectively. If ``b'' is appended, offset is interpreted in blocks of 512 bytes. If file is omitted, offset must be preceded by ``+''.

The display continues until an end-of-file is reached.

Environment variables

If POSIX2 is set, -c is treated as -t c; similarly, -s is treated as -t d2.

Examples

echo "hello world" | od -t c
0000000    h    e    l    l    o         w    o    r    l    d   \n
0000014

echo "hello world" | od -t ax1o1d1 0000000 h e l l o sp w o r l d nl 68 65 6c 6c 6f 20 77 6f 72 6c 64 0a 150 145 154 154 157 040 167 157 162 154 144 012 104 101 108 108 111 032 119 111 114 108 100 010 0000014

Files


/usr/lib/locale/locale/LC_MESSAGES/uxdfm
language-specific message file (See LANG on environ(5).)

Notices

If the input ends when any of the type specifiers still require further bytes to complete a value, the input is extended with NULL bytes, unless the -N count option is used. In the latter case, additional bytes from the input stream are processed beyond count.

od is changed for POSIX2. Application authors should use the new (first) synopsis; the second synopsis may no longer be supported in the future.


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004