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