1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
|
.\" $OpenBSD: od.1,v 1.25 2011/05/06 19:26:22 jmc Exp $
.\" $NetBSD: od.1,v 1.16 2001/12/07 01:23:42 bjh21 Exp $
.\"
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Andrew Brown.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"/
.Dd $Mdocdate: May 6 2011 $
.Dt OD 1
.Os
.Sh NAME
.Nm od
.Nd octal, decimal, hex, ascii dump
.Sh SYNOPSIS
.Nm od
.Bk -words
.Op Fl aBbcDdeFfHhIiLlOovXx
.Op Fl A Ar base
.Op Fl j Ar offset
.Op Fl N Ar length
.Op Fl t Ar type_string
.Sm off
.Oo
.Op Cm \&+
.Li offset
.Op Cm \&.
.Op Cm Bb
.Sm on
.Oc
.Op Ar
.Ek
.Sh DESCRIPTION
.Nm
has been deprecated in favor of
.Xr hexdump 1 .
.Pp
.Xr hexdump 1 ,
if called as
.Nm od ,
provides compatibility for the options described below.
It does not provide compatibility for the
.Fl s
option (see
.Xr strings 1 )
or the
.Fl P ,
.Fl p ,
or
.Fl w
options, nor is compatibility provided for the ``label'' component
of the offset syntax.
.Pp
The options are as follows:
.Bl -tag -width Fl
.It Fl A Ar base
Specify the input address base.
The argument
.Ar base
may be one of
.Cm d ,
.Cm o ,
.Cm x ,
or
.Cm n ,
which specify decimal, octal, hexadecimal
addresses or no address, respectively.
.It Fl a
.Em One-byte character display .
Display the input offset in octal, followed by sixteen
space-separated, three column, space-filled, characters of input data
per line.
Control characters are printed as their names instead of as C-style escapes.
.It Fl B
Same as
.Fl o .
.It Fl b
.Em One-byte octal display .
Display the input offset in octal, followed by sixteen
space-separated, three column, zero-filled, bytes of input data, in
octal, per line.
This is the default output style if no other is selected.
.It Fl c
.Em One-byte character display .
Display the input offset in octal, followed by sixteen
space-separated, three column, space-filled, characters of input data
per line.
Control characters are printed as c style escapes, or as three octal digits,
if no c escape exists for the character.
.It Fl D
.Em Four-byte octal display .
Display the input offset in octal, followed by four space-separated,
ten column, space filled, four-byte units of input data, in octal, per line.
.It Fl d
.Em Two-byte decimal display .
Display the input offset in octal, followed by eight
space-separated, five column, zero-filled, two-byte units
of input data, in unsigned decimal, per line.
.It Fl e
.Em Eight-byte floating point display .
Display the input offset in octal, followed by two space-separated,
twenty-one column, space filled, eight-byte units of input data, in
floating point, per line.
.It Fl F
Same as
.Fl e .
.It Fl f
.Em Four-byte floating point display .
Display the input offset in octal, followed by four space-separated,
14 column, space filled, four-byte units of input data, in floating
point, per line.
.It Fl H
.Em Four-byte hex display .
Display the input offset in octal, followed by four space-separated,
eight column, zero filled, four-byte units of input data, in hex,
per line.
.It Fl h
.Em Two-byte hex display .
Display the input offset in octal, followed by eight space-separated,
four column, zero filled, two-byte units of input data, in hex,
per line.
.It Fl I
.Em Four-byte decimal display .
Display the input offset in octal, followed by four space-separated,
eleven column, space filled, four-byte units of input data, in
decimal, per line.
.It Fl i
.Em Two-byte decimal display .
Display the input offset in octal, followed by eight space-separated,
six column, space filled, two-byte units of input data, in decimal,
per line.
.It Fl j Ar offset
Skip
.Ar offset
bytes from the beginning of the input.
By default,
.Ar offset
is interpreted as a decimal number.
With a leading
.Cm 0x
or
.Cm 0X ,
.Ar offset
is interpreted as a hexadecimal number,
otherwise, with a leading
.Cm 0 ,
.Ar offset
is interpreted as an octal number.
Appending the character
.Cm b ,
.Cm k ,
or
.Cm m
to
.Ar offset
causes it to be interpreted as a multiple of
.Li 512 ,
.Li 1024 ,
or
.Li 1048576 ,
respectively.
.It Fl L
Same as
.Fl I .
.It Fl l
Same as
.Fl I .
.It Fl N Ar length
Interpret only
.Ar length
bytes of input.
.It Fl O
.Em Four-byte octal display .
Display the input offset in octal, followed by four
space-separated, eleven column, zero-filled, four-byte units
of input data, in octal, per line.
.It Fl o
.Em Two-byte octal display .
Display the input offset in octal, followed by eight
space-separated, six column, zero-filled, two-byte units
of input data, in octal, per line.
.It Fl t Ar type_string
Specify one or more output types.
The
.Em type_string
option-argument must be a string specifying the types to be used when
writing the input data.
The string must consist of the type specification characters:
.Pp
.Cm a
selects US-ASCII output, with control characters replaced with their
names instead of as c escape sequences.
See also the
.Cm _u
conversion provided by
.Xr hexdump 1 .
.Pp
.Cm c
selects a standard character based conversion.
See also the
.Cm _c
conversion provided by
.Xr hexdump 1 .
.Pp
.Cm f
selects the floating point output format.
This type character can be optionally followed by the characters
.Cm 4
or
.Cm F
to specify four-byte floating point output, or
.Cm 8
or
.Cm L
to specify eight-byte floating point output.
The default output format is eight-byte floats.
See also the
.Cm e
conversion provided by
.Xr hexdump 1 .
.Pp
.Cm d ,
.Cm o ,
.Cm u ,
or
.Cm x
select decimal, octal, unsigned decimal, or hex output respectively.
These types can optionally be followed by
.Cm C
to specify
.Em char Ns -sized
output,
.Cm S
to specify
.Em short Ns -sized
output,
.Cm I
to specify
.Em int Ns -sized
output,
.Cm L
to specify
.Em long Ns -sized
output,
.Cm 1
to specify one-byte output,
.Cm 2
to specify two-byte output,
.Cm 4
to specify four-byte output, or
.Cm 8
to specify eight-byte output.
The default output format is in four-byte quantities.
See also the
.Cm d ,
.Cm o ,
.Cm u ,
and
.Cm x
conversions provided by
.Xr hexdump 1 .
.\"(a|c|f[FLD]?|[doux][C1S2I4L8]?)*
.It Fl v
The
.Fl v
option causes
.Nm
to display all input data.
Without the
.Fl v
option, any number of groups of output lines, which would be
identical to the immediately preceding group of output lines (except
for the input offsets), are replaced with a line comprised of a
single asterisk.
.It Fl X
Same as
.Fl H .
.It Fl x
Same as
.Fl h .
.El
.Pp
For each input file,
.Nm
sequentially copies the input to standard output, transforming the
data according to the options given.
If no options are specified, the default display is equivalent to
specifying the
.Fl o
option.
.Sh EXIT STATUS
.Ex -std od
.Sh SEE ALSO
.Xr hexdump 1 ,
.Xr strings 1
.Sh HISTORY
The
.Nm
utility is compliant with the
.St -p1003.1-2008
specification.
.Pp
The flags
.Op Fl aBDeFfHhIiLlOX
are extensions to that specification.
.Pp
An
.Nm
command appears in
.At v1 .
.Pp
This man page was written in February 2001 by Andrew Brown, shortly
after he augmented the deprecated od syntax to include things he felt
had been missing for a long time.
|