xref: /minix3/usr.bin/hexdump/od.1 (revision 1e33498f8ca6b050f0a32002ca925d1f0c357a7f)
1*1e33498fSThomas Cort.\"  $NetBSD: od.1,v 1.27 2012/07/06 09:05:26 wiz Exp $
2*1e33498fSThomas Cort.\"
3*1e33498fSThomas Cort.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
4*1e33498fSThomas Cort.\" All rights reserved.
5*1e33498fSThomas Cort.\"
6*1e33498fSThomas Cort.\" This code is derived from software contributed to The NetBSD Foundation
7*1e33498fSThomas Cort.\" by Andrew Brown.
8*1e33498fSThomas Cort.\"
9*1e33498fSThomas Cort.\" Redistribution and use in source and binary forms, with or without
10*1e33498fSThomas Cort.\" modification, are permitted provided that the following conditions
11*1e33498fSThomas Cort.\" are met:
12*1e33498fSThomas Cort.\" 1. Redistributions of source code must retain the above copyright
13*1e33498fSThomas Cort.\"    notice, this list of conditions and the following disclaimer.
14*1e33498fSThomas Cort.\" 2. Redistributions in binary form must reproduce the above copyright
15*1e33498fSThomas Cort.\"    notice, this list of conditions and the following disclaimer in the
16*1e33498fSThomas Cort.\"    documentation and/or other materials provided with the distribution.
17*1e33498fSThomas Cort.\"
18*1e33498fSThomas Cort.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19*1e33498fSThomas Cort.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20*1e33498fSThomas Cort.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21*1e33498fSThomas Cort.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22*1e33498fSThomas Cort.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23*1e33498fSThomas Cort.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24*1e33498fSThomas Cort.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25*1e33498fSThomas Cort.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26*1e33498fSThomas Cort.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27*1e33498fSThomas Cort.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28*1e33498fSThomas Cort.\" POSSIBILITY OF SUCH DAMAGE.
29*1e33498fSThomas Cort.\"/
30*1e33498fSThomas Cort.Dd June 24, 2012
31*1e33498fSThomas Cort.Dt OD 1
32*1e33498fSThomas Cort.Os
33*1e33498fSThomas Cort.Sh NAME
34*1e33498fSThomas Cort.Nm od
35*1e33498fSThomas Cort.Nd octal, decimal, hex, ascii dump
36*1e33498fSThomas Cort.Sh SYNOPSIS
37*1e33498fSThomas Cort.Nm
38*1e33498fSThomas Cort.Op Fl aBbcDdeFfHhIiLlOovXx
39*1e33498fSThomas Cort.Op Fl A Ar base
40*1e33498fSThomas Cort.Op Fl j Ar skip
41*1e33498fSThomas Cort.Op Fl N Ar length
42*1e33498fSThomas Cort.Op Fl t Ar type_string
43*1e33498fSThomas Cort.Sm off
44*1e33498fSThomas Cort.Oo
45*1e33498fSThomas Cort.Op Cm \&+
46*1e33498fSThomas Cort.Li offset
47*1e33498fSThomas Cort.Op Cm \&.
48*1e33498fSThomas Cort.Op Cm Bb
49*1e33498fSThomas Cort.Sm on
50*1e33498fSThomas Cort.Oc
51*1e33498fSThomas Cort.Op Ar
52*1e33498fSThomas Cort.Sh DESCRIPTION
53*1e33498fSThomas CortThe
54*1e33498fSThomas Cort.Nm
55*1e33498fSThomas Cortutility is a filter which displays each specified
56*1e33498fSThomas Cort.Ar file ,
57*1e33498fSThomas Cortor the standard input if no
58*1e33498fSThomas Cort.Ar file
59*1e33498fSThomas Cortarguments are specified, in a user specified
60*1e33498fSThomas Cortformat.
61*1e33498fSThomas Cort.Pp
62*1e33498fSThomas CortThe options are as follows:
63*1e33498fSThomas Cort.Bl -tag -width Fl
64*1e33498fSThomas Cort.It Fl A Ar base
65*1e33498fSThomas CortSpecify the input address base.
66*1e33498fSThomas Cort.Ar base
67*1e33498fSThomas Cortmay be one of
68*1e33498fSThomas Cort.Ql d ,
69*1e33498fSThomas Cort.Ql o ,
70*1e33498fSThomas Cort.Ql x
71*1e33498fSThomas Cortor
72*1e33498fSThomas Cort.Ql n ,
73*1e33498fSThomas Cortwhich specify decimal, octal, hexadecimal
74*1e33498fSThomas Cortaddresses or no address, respectively.
75*1e33498fSThomas Cort.It Fl a
76*1e33498fSThomas Cort.Em One-byte character display .
77*1e33498fSThomas CortDisplay the input offset in octal, followed by sixteen
78*1e33498fSThomas Cortspace-separated, three column, space-filled, characters of input data
79*1e33498fSThomas Cortper line.
80*1e33498fSThomas CortControl characters are printed as their names instead of as
81*1e33498fSThomas CortC-style escapes.
82*1e33498fSThomas Cort.It Fl B
83*1e33498fSThomas CortSame as
84*1e33498fSThomas Cort.Fl o .
85*1e33498fSThomas Cort.It Fl b
86*1e33498fSThomas Cort.Em One-byte octal display .
87*1e33498fSThomas CortDisplay the input offset in octal, followed by sixteen
88*1e33498fSThomas Cortspace-separated, three column, zero-filled, bytes of input data, in
89*1e33498fSThomas Cortoctal, per line.
90*1e33498fSThomas CortThis is the default output style if no other is
91*1e33498fSThomas Cortselected.
92*1e33498fSThomas Cort.It Fl c
93*1e33498fSThomas Cort.Em One-byte character display .
94*1e33498fSThomas CortDisplay the input offset in octal, followed by sixteen
95*1e33498fSThomas Cortspace-separated, three column, space-filled, characters of input data
96*1e33498fSThomas Cortper line.
97*1e33498fSThomas CortControl characters are printed at C-style escapes, or as
98*1e33498fSThomas Cortthree octal digits, if no C escape exists for the character.
99*1e33498fSThomas Cort.It Fl d
100*1e33498fSThomas Cort.Em Two-byte decimal display .
101*1e33498fSThomas CortDisplay the input offset in octal, followed by eight
102*1e33498fSThomas Cortspace-separated, five column, zero-filled, two-byte units
103*1e33498fSThomas Cortof input data, in unsigned decimal, per line.
104*1e33498fSThomas Cort.It Fl e
105*1e33498fSThomas Cort.Em Eight-byte floating point display .
106*1e33498fSThomas CortDisplay the input offset in octal, followed by two space-separated,
107*1e33498fSThomas Corttwenty-one column, space filled, eight byte units of input data, in
108*1e33498fSThomas Cortfloating point, per line.
109*1e33498fSThomas Cort.It Fl F
110*1e33498fSThomas CortSame as
111*1e33498fSThomas Cort.Fl e .
112*1e33498fSThomas Cort.It Fl f
113*1e33498fSThomas Cort.Em Four-byte floating point display .
114*1e33498fSThomas CortDisplay the input offset in octal, followed by four space-separated,
115*1e33498fSThomas Cort14 column, space filled, four byte units of input data, in floating
116*1e33498fSThomas Cortpoint, per line.
117*1e33498fSThomas Cort.It Fl H
118*1e33498fSThomas Cort.Em Four-byte hex display .
119*1e33498fSThomas CortDisplay the input offset in octal, followed by four space-separated,
120*1e33498fSThomas Corteight column, zero filled, four byte units of input data, in hex,
121*1e33498fSThomas Cortper line.
122*1e33498fSThomas Cort.It Fl h
123*1e33498fSThomas Cort.Em Two-byte hex display .
124*1e33498fSThomas CortDisplay the input offset in octal, followed by eight space-separated,
125*1e33498fSThomas Cortfour column, zero filled, two byte units of input data, in hex,
126*1e33498fSThomas Cortper line.
127*1e33498fSThomas Cort.It Fl I
128*1e33498fSThomas Cort.Em Four-byte decimal display .
129*1e33498fSThomas CortDisplay the input offset in octal, followed by four space-separated,
130*1e33498fSThomas Corteleven column, space filled, four byte units of input data, in
131*1e33498fSThomas Cortdecimal, per line.
132*1e33498fSThomas Cort.It Fl i
133*1e33498fSThomas Cort.Em Two-byte decimal display .
134*1e33498fSThomas CortDisplay the input offset in octal, followed by eight space-separated,
135*1e33498fSThomas Cortsix column, space filled, two-byte units of input data, in decimal,
136*1e33498fSThomas Cortper line.
137*1e33498fSThomas Cort.It Fl j Ar skip
138*1e33498fSThomas CortSkip
139*1e33498fSThomas Cort.Ar skip
140*1e33498fSThomas Cortbytes from the beginning of the input.
141*1e33498fSThomas CortBy default,
142*1e33498fSThomas Cort.Ar skip
143*1e33498fSThomas Cortis interpreted as a decimal number.
144*1e33498fSThomas CortWith a leading
145*1e33498fSThomas Cort.Cm 0x
146*1e33498fSThomas Cortor
147*1e33498fSThomas Cort.Cm 0X ,
148*1e33498fSThomas Cort.Ar skip
149*1e33498fSThomas Cortis interpreted as a hexadecimal number;
150*1e33498fSThomas Cortotherwise, with a leading
151*1e33498fSThomas Cort.Cm 0 ,
152*1e33498fSThomas Cort.Ar skip
153*1e33498fSThomas Cortis interpreted as an octal number.
154*1e33498fSThomas CortAppending the character
155*1e33498fSThomas Cort.Cm b ,
156*1e33498fSThomas Cort.Cm k ,
157*1e33498fSThomas Cortor
158*1e33498fSThomas Cort.Cm m
159*1e33498fSThomas Cortto
160*1e33498fSThomas Cort.Ar skip
161*1e33498fSThomas Cortcauses it to be interpreted as a multiple of
162*1e33498fSThomas Cort.Li 512 ,
163*1e33498fSThomas Cort.Li 1024 ,
164*1e33498fSThomas Cortor
165*1e33498fSThomas Cort.Li 1048576 ,
166*1e33498fSThomas Cortrespectively.
167*1e33498fSThomas Cort.It Fl L
168*1e33498fSThomas CortSame as
169*1e33498fSThomas Cort.Fl I .
170*1e33498fSThomas Cort.It Fl l
171*1e33498fSThomas CortSame as
172*1e33498fSThomas Cort.Fl I .
173*1e33498fSThomas Cort.It Fl N Ar length
174*1e33498fSThomas CortInterpret only
175*1e33498fSThomas Cort.Ar length
176*1e33498fSThomas Cortbytes of input.
177*1e33498fSThomas Cort.It Fl O
178*1e33498fSThomas Cort.Em Four-byte octal display .
179*1e33498fSThomas CortDisplay the input offset in octal, followed by four
180*1e33498fSThomas Cortspace-separated, eleven column, zero-filled, four-byte units
181*1e33498fSThomas Cortof input data, in octal, per line.
182*1e33498fSThomas Cort.It Fl o
183*1e33498fSThomas Cort.Em Two-byte octal display .
184*1e33498fSThomas CortDisplay the input offset in octal, followed by eight
185*1e33498fSThomas Cortspace-separated, six column, zero-filled, two-byte units
186*1e33498fSThomas Cortof input data, in octal, per line.
187*1e33498fSThomas Cort.It Fl t Ar type_string
188*1e33498fSThomas CortSpecify one or more output types.
189*1e33498fSThomas CortThe
190*1e33498fSThomas Cort.Em type_string
191*1e33498fSThomas Cortoption-argument must be a string specifying the types to be used when
192*1e33498fSThomas Cortwriting the input data.
193*1e33498fSThomas CortThe string must consist of the type specification characters:
194*1e33498fSThomas Cort.Pp
195*1e33498fSThomas Cort.Cm a
196*1e33498fSThomas Cortselects US-ASCII output, with control characters replaced with their
197*1e33498fSThomas Cortnames instead of as C escape sequences.
198*1e33498fSThomas CortSee also the
199*1e33498fSThomas Cort.Cm _u
200*1e33498fSThomas Cortconversion provided by
201*1e33498fSThomas Cort.Xr hexdump 1 .
202*1e33498fSThomas Cort.Pp
203*1e33498fSThomas Cort.Cm c
204*1e33498fSThomas Cortselects a standard character based conversion.
205*1e33498fSThomas CortSee also the
206*1e33498fSThomas Cort.Cm _c
207*1e33498fSThomas Cortconversion provided by
208*1e33498fSThomas Cort.Xr hexdump 1 .
209*1e33498fSThomas Cort.Pp
210*1e33498fSThomas Cort.Cm f
211*1e33498fSThomas Cortselects the floating point output format.
212*1e33498fSThomas CortThis type character can be optionally followed by the characters
213*1e33498fSThomas Cort.Cm 4
214*1e33498fSThomas Cortor
215*1e33498fSThomas Cort.Cm F
216*1e33498fSThomas Cortto specify four byte floating point output, or
217*1e33498fSThomas Cort.Cm 8
218*1e33498fSThomas Cortor
219*1e33498fSThomas Cort.Cm L
220*1e33498fSThomas Cortto specify eight byte floating point output.
221*1e33498fSThomas CortThe default output format is eight byte floats.
222*1e33498fSThomas CortSee also the
223*1e33498fSThomas Cort.Cm e
224*1e33498fSThomas Cortconversion provided by
225*1e33498fSThomas Cort.Xr hexdump 1 .
226*1e33498fSThomas Cort.Pp
227*1e33498fSThomas Cort.Cm d ,
228*1e33498fSThomas Cort.Cm o ,
229*1e33498fSThomas Cort.Cm u ,
230*1e33498fSThomas Cortor
231*1e33498fSThomas Cort.Cm x
232*1e33498fSThomas Cortselect decimal, octal, unsigned decimal, or hex output respectively.
233*1e33498fSThomas CortThese types can optionally be followed by
234*1e33498fSThomas Cort.Cm C
235*1e33498fSThomas Cortto specify
236*1e33498fSThomas Cort.Em char Ns -sized
237*1e33498fSThomas Cortoutput,
238*1e33498fSThomas Cort.Cm S
239*1e33498fSThomas Cortto specify
240*1e33498fSThomas Cort.Em short Ns -sized
241*1e33498fSThomas Cortoutput,
242*1e33498fSThomas Cort.Cm I
243*1e33498fSThomas Cortto specify
244*1e33498fSThomas Cort.Em int Ns -sized
245*1e33498fSThomas Cortoutput,
246*1e33498fSThomas Cort.Cm L
247*1e33498fSThomas Cortto specify
248*1e33498fSThomas Cort.Em long Ns -sized
249*1e33498fSThomas Cortoutput,
250*1e33498fSThomas Cort.Cm 1
251*1e33498fSThomas Cortto specify one-byte output,
252*1e33498fSThomas Cort.Cm 2
253*1e33498fSThomas Cortto specify two-byte output,
254*1e33498fSThomas Cort.Cm 4
255*1e33498fSThomas Cortto specify four-byte output, or
256*1e33498fSThomas Cort.Cm 8
257*1e33498fSThomas Cortto specify eight-byte output.
258*1e33498fSThomas CortThe default output format is in four-byte quantities.
259*1e33498fSThomas CortSee also the
260*1e33498fSThomas Cort.Cm d ,
261*1e33498fSThomas Cort.Cm o ,
262*1e33498fSThomas Cort.Cm u ,
263*1e33498fSThomas Cortand
264*1e33498fSThomas Cort.Cm x
265*1e33498fSThomas Cortconversions provided by
266*1e33498fSThomas Cort.Xr hexdump 1 .
267*1e33498fSThomas Cort.\"(a|c|f[FLD]?|[doux][C1S2I4L8]?)*
268*1e33498fSThomas Cort.It Fl v
269*1e33498fSThomas CortThe
270*1e33498fSThomas Cort.Fl v
271*1e33498fSThomas Cortoption causes
272*1e33498fSThomas Cort.Nm
273*1e33498fSThomas Cortto display all input data.
274*1e33498fSThomas CortWithout the
275*1e33498fSThomas Cort.Fl v
276*1e33498fSThomas Cortoption, any number of groups of output lines, which would be
277*1e33498fSThomas Cortidentical to the immediately preceding group of output lines (except
278*1e33498fSThomas Cortfor the input offsets), are replaced with a line comprised of a
279*1e33498fSThomas Cortsingle asterisk
280*1e33498fSThomas Cort.Pq Sq \&* .
281*1e33498fSThomas Cort.It Fl X
282*1e33498fSThomas CortSame as
283*1e33498fSThomas Cort.Fl H .
284*1e33498fSThomas Cort.It Fl x
285*1e33498fSThomas CortSame as
286*1e33498fSThomas Cort.Fl h .
287*1e33498fSThomas Cort.El
288*1e33498fSThomas Cort.Pp
289*1e33498fSThomas CortFor each input file,
290*1e33498fSThomas Cort.Nm
291*1e33498fSThomas Cortsequentially copies the input to standard output, transforming the
292*1e33498fSThomas Cortdata according to the options given.
293*1e33498fSThomas CortIf no options are specified, the
294*1e33498fSThomas Cortdefault display is equivalent to specifying the
295*1e33498fSThomas Cort.Fl o
296*1e33498fSThomas Cortoption.
297*1e33498fSThomas Cort.Sh EXIT STATUS
298*1e33498fSThomas Cort.Ex -std
299*1e33498fSThomas Cort.Sh SEE ALSO
300*1e33498fSThomas Cort.Xr hexdump 1 ,
301*1e33498fSThomas Cort.Xr strings 1
302*1e33498fSThomas Cort.Sh HISTORY
303*1e33498fSThomas CortAn
304*1e33498fSThomas Cort.Nm
305*1e33498fSThomas Cortcommand appeared in
306*1e33498fSThomas Cort.At v1 .
307*1e33498fSThomas Cort.Pp
308*1e33498fSThomas CortThis man page was initially written in February 2001 by Andrew Brown, shortly
309*1e33498fSThomas Cortafter he augmented the deprecated
310*1e33498fSThomas Cort.Nm
311*1e33498fSThomas Cortsyntax to include things he felt
312*1e33498fSThomas Corthad been missing for a long time.
313