xref: /netbsd-src/usr.bin/hexdump/od.1 (revision a5847cc334d9a7029f6352b847e9e8d71a0f9e0c)
1.\"  $NetBSD: od.1,v 1.25 2010/02/09 14:25:39 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 February 9, 2010
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.Bk -words
40.Op Fl A Ar base
41.Op Fl j Ar skip
42.Ek
43.Bk -words
44.Op Fl N Ar length
45.Ek
46.Bk -words
47.Op Fl t Ar type_string
48.Ek
49.Sm off
50.Oo
51.Op Cm \&+
52.Li offset
53.Op Cm \&.
54.Op Cm Bb
55.Sm on
56.Oc
57.Ar file ...
58.Sh DESCRIPTION
59The options are as follows:
60.Bl -tag -width Fl
61.It Fl A Ar base
62Specify the input address base.
63.Ar base
64may be one of
65.Ql d ,
66.Ql o ,
67.Ql x
68or
69.Ql n ,
70which specify decimal, octal, hexadecimal
71addresses or no address, respectively.
72.It Fl a
73.Em One-byte character display .
74Display the input offset in octal, followed by sixteen
75space-separated, three column, space-filled, characters of input data
76per line.
77Control characters are printed as their names instead of as
78C-style escapes.
79.It Fl B
80Same as
81.Fl o .
82.It Fl b
83.Em One-byte octal display .
84Display the input offset in octal, followed by sixteen
85space-separated, three column, zero-filled, bytes of input data, in
86octal, per line.
87This is the default output style if no other is
88selected.
89.It Fl c
90.Em One-byte character display .
91Display the input offset in octal, followed by sixteen
92space-separated, three column, space-filled, characters of input data
93per line.
94Control characters are printed at C-style escapes, or as
95three octal digits, if no C escape exists for the character.
96.It Fl d
97.Em Two-byte decimal display .
98Display the input offset in octal, followed by eight
99space-separated, five column, zero-filled, two-byte units
100of input data, in unsigned decimal, per line.
101.It Fl e
102.Em Eight-byte floating point display .
103Display the input offset in octal, followed by two space-separated,
104twenty-one column, space filled, eight byte units of input data, in
105floating point, per line.
106.It Fl F
107Same as
108.Fl e .
109.It Fl f
110.Em Four-byte floating point display .
111Display the input offset in octal, followed by four space-separated,
11214 column, space filled, four byte units of input data, in floating
113point, per line.
114.It Fl H
115.Em Four-byte hex display .
116Display the input offset in octal, followed by four space-separated,
117eight column, zero filled, four byte units of input data, in hex,
118per line.
119.It Fl h
120.Em Two-byte hex display .
121Display the input offset in octal, followed by eight space-separated,
122four column, zero filled, two byte units of input data, in hex,
123per line.
124.It Fl I
125.Em Four-byte decimal display .
126Display the input offset in octal, followed by four space-separated,
127eleven column, space filled, four byte units of input data, in
128decimal, per line.
129.It Fl i
130.Em Two-byte decimal display .
131Display the input offset in octal, followed by eight space-separated,
132six column, space filled, two-byte units of input data, in decimal,
133per line.
134.It Fl j Ar offset
135Skip
136.Ar offset
137bytes from the beginning of the input.
138By default,
139.Ar offset
140is interpreted as a decimal number.
141With a leading
142.Cm 0x
143or
144.Cm 0X ,
145.Ar offset
146is interpreted as a hexadecimal number,
147otherwise, with a leading
148.Cm 0 ,
149.Ar offset
150is interpreted as an octal number.
151Appending the character
152.Cm b ,
153.Cm k ,
154or
155.Cm m
156to
157.Ar offset
158causes it to be interpreted as a multiple of
159.Li 512 ,
160.Li 1024 ,
161or
162.Li 1048576 ,
163respectively.
164.It Fl L
165Same as
166.Fl I .
167.It Fl l
168Same as
169.Fl I .
170.It Fl N Ar length
171Interpret only
172.Ar length
173bytes of input.
174.It Fl O
175.Em Four-byte octal display .
176Display the input offset in octal, followed by four
177space-separated, eleven column, zero-filled, four-byte units
178of input data, in octal, per line.
179.It Fl o
180.Em Two-byte octal display .
181Display the input offset in octal, followed by eight
182space-separated, six column, zero-filled, two-byte units
183of input data, in octal, per line.
184.It Fl t Ar type_string
185Specify one or more output types.
186The
187.Em type_string
188option-argument must be a string specifying the types to be used when
189writing the input data.
190The string must consist of the type specification characters:
191.Pp
192.Cm a
193selects US-ASCII output, with control characters replaced with their
194names instead of as C escape sequences.
195See also the
196.Cm _u
197conversion provided by hexdump(1).
198.Pp
199.Cm c
200selects a standard character based conversion.
201See also the
202.Cm _c
203conversion provided by hexdump(1).
204.Pp
205.Cm f
206selects the floating point output format.
207This type character can be optionally followed by the characters
208.Cm 4
209or
210.Cm F
211to specify four byte floating point output, or
212.Cm 8
213or
214.Cm L
215to specify eight byte floating point output.
216The default output format is eight byte floats.
217See also the
218.Cm e
219conversion provided by hexdump(1).
220.Pp
221.Cm d ,
222.Cm o ,
223.Cm u ,
224or
225.Cm x
226select decimal, octal, unsigned decimal, or hex output respectively.
227These types can optionally be followed by
228.Cm C
229to specify
230.Em char Ns -sized
231output,
232.Cm S
233to specify
234.Em short Ns -sized
235output,
236.Cm I
237to specify
238.Em int Ns -sized
239output,
240.Cm L
241to specify
242.Em long Ns -sized
243output,
244.Cm 1
245to specify one-byte output,
246.Cm 2
247to specify two-byte output,
248.Cm 4
249to specify four-byte output, or
250.Cm 8
251to specify eight-byte output.
252The default output format is in four-byte quantities.
253See also the
254.Cm d ,
255.Cm o ,
256.Cm u ,
257and
258.Cm x
259conversions provided by hexdump(1).
260.\"(a|c|f[FLD]?|[doux][C1S2I4L8]?)*
261.It Fl v
262The
263.Fl v
264option causes
265.Nm
266to display all input data.
267Without the
268.Fl v
269option, any number of groups of output lines, which would be
270identical to the immediately preceding group of output lines (except
271for the input offsets), are replaced with a line comprised of a
272single asterisk.
273.It Fl X
274Same as
275.Fl H .
276.It Fl x
277Same as
278.Fl h .
279.El
280.Pp
281For each input file,
282.Nm
283sequentially copies the input to standard output, transforming the
284data according to the options given.
285If no options are specified, the
286default display is equivalent to specifying the
287.Fl o
288option.
289.Pp
290.Nm
291exits 0 on success and \*[Gt]0 if an error occurred.
292.Sh SEE ALSO
293.Xr hexdump 1 ,
294.Xr strings 1
295.Sh HISTORY
296A
297.Nm
298command appears in
299.At v1 .
300.Pp
301This man page was written in February 2001 by Andrew Brown, shortly
302after he augmented the deprecated od syntax to include things he felt
303had been missing for a long time.
304