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