dump files in numeric and readable
Where type is a string of
Discards skip bytes of files (standard input stream if "-", the default), then formats max (unlimited) bytes, width (16) per line, with an address, interpreted as types.
|a||ASCII||1||Strip top bit, format non-printable bytes and space as in ascii(7) (in lower-case), others verbatim.|
|c||Character||≥1||Non-printables and invalid sequences written as octal bytes. Control characters written as C escapes. Multi-byte characters are written at their start, remaining bytes are "**". Not affected by block boundaries.|
|x||Hexadecimal integer||1, 2, 4, 8||Respectively: C (char), S (short), I (int), L (long). xo zero-padded, ud space-padded. Defaults to I (4).|
|u||Unsigned decimal integer|
|d||Signed decimal integer|
|f||Floating-point number||4, 8, 16||Respectively: F (float), D (double), L (long double), to the recovery precision. Defaults to D (8).|
These may be suffixed with a
provide a dump of printable bytes on the right margin, with non-printables
replaced with a
zZ to do the same for characters. Many
types may be pasted together or passed to multiple
The input is taken to be as-if
[file]…. If this doesn't evenly divide a
type, then it's filled out with zero bytes. With
multiple types, output is right-aligned to their
respective boundaries. Multi-byte types are cast
directly into this system's their native representation (least significant
Data for each line is preceded by an address, governed by
skip, max, and width are in the mostly-case-insensitive format:
In the latter synoptical forms, skip is
octal (decimal and
.’, else hexadecimal and
x’), multiplied by
512 if ‘
- By default, consecutive identical lines are replaced with a line of just "*"; write them all, instead.
- Seek over (or read and discard) skip bytes of the input.
- Consume at most max bytes.
- Each output line contains width bytes. Rounded down to a multiple of the widest type.
- See above. Defaults to
- Cast input data as types. See above. Defaults to
- No effect.
- Reverse each value's bytes before casting.
The values are prefix-matched (
--endian=b is equivalent to
|-c||Like -tc, but bytes and not "\a" or "\v".|
|-x||=||-t x2||-d||=||-t u2||-s||=||-t d2||-b||=||-t o1||-o||=||-t o2||-f||=||-t f4|
1 if a file couldn't be opened or read or skip could not be satisfied.
od0000000 005061 005062 005063 005064 005065 005066 005067 005070 0000020 005071 030061 000012 0000025
# like hexdump(1)000002 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a 39 0a >126.96.36.199.188.8.131.52.< 000012 31 30 >10< 000014
n1 nl 2 nl 3 nl 4 nl 5 nl 6 nl 7 nl 8 nl >184.108.40.206.220.127.116.11.< 1.6292135911574872e-259 1.9544134620527668e-259 9 nl 1 0 nl >9.10.< 2.16194199887e-313
Żupan z 雨港
-N14 0000000 Ż ** u p a n z 雨 ** ** 346 270 >..upan z .....< Ż ** u p a n z 雨 ** ** 346 270 >Ż*upan z 雨*..< -17467 28789 28257 31264 -5856 -22373 -18202 0000014
Conforms to IEEE Std 1003.1-2008
(“POSIX.1”). The default address base and
width are unspecified, but all implementations agree
o and 16.
skip and max are guaranteed to
and 0 prefixes for base-16 and base-8; only
skip is required to accept suffixes, and only
b. 1-, 2-,
xudos are required to be
present, even if no native sizes or alphabetic names for them exist. The
f are accurate for IEEE
Std 754-1985 systems — alphabetic names are guaranteed to
exist to map to their respective C types; numeric names must correspond to
are shaded XSI and are provided for compatibility with legacy applications
only. Don't use them, guard against them by always specifying a flag
-A is well-suited). The POSIX requirements
contradict Version 7 AT&T UNIX (imply
and don't mention ‘
-f is provided for compatibility with
AT&T System V Release 4 UNIX and
z type suffix,
extensions, originating from the GNU system. Its width
is a plain number and always reset to the smallest — instead of the
closest acceptable — value. The
zZ suffix is
c mode formats NUL
(0) as "\0", the bell
"\a", the backspace
"\b", the form-feed
the new-line (0xA) as "\n",
the carriage return
"\t", the vertical tab
a mode is
allowed to format the new-line (0xA) as either
(the proper "LINE FEED"-derived short-hand) or
— all implementations except for the illumos gate use the latter for
compatibility with 4.2BSD.
Strictly, same-line folding ought to apply to output lines, not
input blocks — there are pathological scenarios where this could
Appears in the first edition of the UNIX Programmer's Manual as od (I):
origin — octal and rounded down to the closest multiple of the line size (16) — functions like skip, and discards (parts of the) read blocks.
Version 2 AT&T UNIX elaborates
db recommendation thusly:
The BUGS are removed.
Version 3 AT&T UNIX sees
od [ -abcdho ] [ file ] [ [+]offset[.][b] ]
-abcdho] file [[
+only required if no file), matching the present-day XSI semantics (plus ‘8’ and ‘9’ are allowed in octal mode and
file defaults to the standard input
stream if not specified;
-dob are as present-day,
-x is equivalent to present-day
-c is like
-c except only "\0",
"\t", and "\n" are
recognised and all other non-printables are written as
disassembles (but just the opcodes), with unknown formatted as
Multiple formats are allowed, but are always written in the order
-odahcb. They do a pretty good job of being aligned,
and not over-aligned.
The no-seek stanza is removed, and offset first sets the file position to offset/512 (with no error checking), then eats the remainder. The position is untouched without offset.
An inscrutable deduplication scheme appears at some
point in [Version 3 AT&T UNIX,
Version 5 AT&T UNIX], discarding
words. Note how
these files differ only by one or two bytes (and never-mind the
.0000000 0 0 0009984 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \0 0009999
.0000000 a 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0010000
.0000000 a a 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0000016 0 0 0010000 0 \0 0010001
Version 7 AT&T UNIX sees a SYNOPSIS of
-x was renamed from
-h and matches present-day
-h is still accepted).
is as present-day. With multiple types, addresses are continued with a tab
instead of eight spaces.
The word-squeezing scheme is replaced with the present-day line-based one.
Undocumentedly, offset may start with a
0x for lower-case
hexadecimal (this, again, propagates as-if
x; thankfully hexadecimal
characters are only allowed in hexadecimal mode), this is still overridden
B is accepted as well
b. To this end, the
SYNOPSIS may be better-served as
-bcdoshx] file [[
3BSD naturally sees
Version 7 AT&T UNIX
od, but re-adds
-a to the
SYNOPSIS (and only there).
4.2BSD upgrades the NAME to "od - octal, decimal, hex, ascii dump", which is still somehow not enough, and sees a SYNOPSIS of
usage: od [-abcdfhilopswvx] [file] [[+]offset[.][b] [label]]
usage: od [-abBcdDefFhHiIlLopPs[n]vw[n]xX] [file] [[+]offset[.][b] [label]]
vw[width…]}…] file [[
pPmay be at any point in the flag). The implied
-Afor label overrides the one for
-A, if any. label causes an additional address to be written, following the normal one, but starting at label instead of offset (0); this may correspond to the first line of
0000040 (0000020) k dc3 Z 4 bs M dc3 etx a ? ht e Q si 6 F
bmultiplies by 512 and
Bmultiplies by 1024. The address(ses) are followed by two spaces, not one.
file has links, and is not a teletype, it's sought
"in multiples of a physical block" "in case we're accessing a
raw disk" (512), then read, otherwise just read. The
no-links check is commented "
but it'll also (falsely) succeed if file is simply
removed after being opened, but (correctly) succeed for sockets. The file
position is still set instead of advanced, but
if reading to skip,
pre-mature end-of-file is met with an error, similar to present-day. Thus,
on a seekable file is all-but-guaranteed to produce
fffffe00" as the sole output but
– to error.
-a is like present-day
"a"; additionally, if
is also specified, the cells for bytes with even parity (even number of set
bits before stripping) are underlined by formatting them as
-P – odd
parity, whichever's last.
-w may be succeeded by a decimal
string and defaults to
32 if it isn't or it's
just zeroes — much like present-day
-v is invented as present-day. Single-byte formats
abc) no longer have a phantom zero byte at the end
of odd-length inputs.
-HX are both equivalent to
-B is an alias for
-i is equivalent to present-day
-s (and the formatter name suggests that it was
simply re-named from Version 7 AT&T UNIX
-s, and quite late).
equivalent to present-day
and both of
-f uses a fixed
(fixed-precision scientific notation). On the VAX, which uses some cursed
non-IEEE Std 754-1985 floats and would otherwise
SIGILL in this case, if the second-least significant
byte of the first four bytes is
they're instead formatted as-if x4.
-v and is a
strings(1)-like mode, finding strings of at least
"ascii graphic" (actually printable + the non-NUL ones from
-c) bytes, followed by a NUL (0),
and outputting them each on their own line, unsuppressably preceded by the
address(es) of their first byte.
min and width greater than 1024 overrun the buffer, Up to 31 types may be specified (more overrun the buffer), and their order is respected.
The manual specs a scarce few of the
(displaying with their ACSII names),
v (though you wouldn't call it a format),
w[width…]. This leaves
BDeFHXIL undocumented, which represent three unique
DFX). Uncharacteristically, the
offset and label are
fully-documented (except that the "radix" (base) of
label overrides that of offset,
and offset-past-end behaviour).
The BUGS are plenty: "It is an
historical botch to require specification of object, radix, and sign
representation in a single character argument." — foreshadowing
-t — "A hexadecimal
offset can't be a block count." — strictly false: it can't be a
512-byte block count, since the
is consumed as the number; it can be a 1024-byte block
count since the offset and label
only parse lower-case hexadecimal — &c.
4.3BSD-Reno sees a SYNOPSIS of
odas a basename-selected parser effectively injecting
-earguments to hexdump(1) (except, of course,
-s, which defers to strings(1) — which, notably, had the same base-line capability even in 4.2BSD —
-Ppwhich are in the SYNOPSIS by accident and yield an error, and
-w, which just yields an error). BUGS are re-assessed as "Quite a few.". The old implementation is distributed in source form in /usr/src/old until 4.4BSD-Lite.
4.4BSD sees a SYNOPSIS of
-aBbcDdeFfHhIiLlOovXx] [file] [[
Bb]] (if not
+, then offset must start with a digit or ‘x’ and a hexadecimal digit)
Bbs, which are now exclusive. Invalid digits are now silently ignored and the argument is unconsumed.
xrequires that the second character is a hexadecimal digit;
.excludes, instead of overrding, [
x. Garbage at either end causes the argument to be left unconsumed.
AT&T System III UNIX sees v7
od except it exits 2 if
file failed to open.
AT&T System V Release 1
-s, as present-day (ordered as
BSIZE (which depends on the filesystem configured
when building — 512 for the
"original" (and when built with dual-filesystem support)
and 1024 for the new one),
instead of 512 (the manual, naturally, does not reflect
AT&T System V Release 3 UNIX uses 512 again.
AT&T System V Release 4 UNIX shoe-horns the 4.2BSD format-order code into a minimally-changed implementation with a SYNOPSIS of
-fFequivalent to 4.2BSD (sans the VAX bullshit), and
-XDSOequivalent to their lower-case present-day variants but for four-byte integers (similar, again, to 4.2BSD but without the
X/Open Portability Guide Issue 2
(“XPG2”) includes AT&T System V
Release 3 UNIX
— shaded OF ("Output format incompletely specified"
– it isn't at all) — with editorial differences and
-s shaded PI ("The behaviour cannot be
guaranteed to be consistent"), no doubt in reference to
IEEE Std 1003.2-1992 (“POSIX.2”) invents the modern
-A address_base] [
-j skip] [
-n count] [
-t type_string] ... [file ...]
-v) were passed and the first argument starts with a digit or a ‘+’.
hexdump(1) cites "POSIX 1003.2" compatibility (and
od obsolescence thereon). The
History indicates that in Draft 10,
hexdump" was "renamed"
(entirely re-invented) to "
od". This is
further lamp-shaded in the
History of Decisions
hexdump description was much more complex than
needed for a simple dump utility.".
X/Open Portability Guide Issue 4
(“XPG4”) adds the AT&T
System V Release 3 UNIX usage, shaded EX (equivalent to
present-day XSI), on top of the IEEE Std 1003.2-1992
is still also shaded PI, even though it's defined as "equivalent to
-t d2". offset is additionally only
recognised if there are up to two arguments.
FUTURE DIRECTIONS warn that all
EX-shaded features may be withdrawn in the future. Oh, what a world this
The Single UNIX
Specification (“SUS”) defines
-c to "interpret bytes as characters specified
by the current setting of the LC_CTYPE category" (instead of the POSIX
locale, which is as-if ASCII) — which doesn't really match what
implementations do at all (AT&T System V
Release 4 UNIX says it does so, but that's
not at all true and depending on the locale it takes a longer or shorter
path to format bytes with the high bit set as three octal digits)
— and that it's "equivalent to -t c", which it
isn't, not only due to the aforementioned, but also because it doesn't catch
\a and \v.
Version 2 of the Single UNIX Specification
(“SUSv2”) removes the mistaken
c equivalency stanza.
Version 3 of the Single UNIX Specification
-s PI and
changes offset recognition to present-day: last
argument starts with a
+ or two arguments and the
second starts with a "numeric" byte.
IEEE Std 1003.1-2008
(“POSIX.1”) allows the
"-"-as-standard-input-stream behaviour and also
suppresses offset handling if
-v was passed, as present-day.