xref: /netbsd-src/usr.bin/hexdump/od.1 (revision 10ad5ffa714ce1a679dcc9dd8159648df2d67b5a)
1.\"  $NetBSD: od.1,v 1.23 2008/09/03 16:32:57 drochner 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 September 3, 2008
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
59.Nm
60has been deprecated in favor of
61.Xr hexdump 1 .
62.Pp
63.Xr hexdump 1 ,
64if called as
65.Nm ,
66provides compatibility for the options described below.
67It does not provide compatibility for the
68.Fl s
69option (see
70.Xr strings 1 )
71or the
72.Fl P ,
73.Fl p ,
74or
75.Fl w
76options, nor is compatibility provided for the ``label'' component
77of the offset syntax.
78.Pp
79The options are as follows:
80.Bl -tag -width Fl
81.It Fl A Ar base
82Specify the input address base.
83.Ar base
84may be one of
85.Ql d ,
86.Ql o ,
87.Ql x
88or
89.Ql n ,
90which specify decimal, octal, hexadecimal
91addresses or no address, respectively.
92.It Fl a
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 as their names instead of as
98C-style escapes.
99.It Fl B
100Same as
101.Fl o .
102.It Fl b
103.Em One-byte octal display .
104Display the input offset in octal, followed by sixteen
105space-separated, three column, zero-filled, bytes of input data, in
106octal, per line.
107This is the default output style if no other is
108selected.
109.It Fl c
110.Em One-byte character display .
111Display the input offset in octal, followed by sixteen
112space-separated, three column, space-filled, characters of input data
113per line.
114Control characters are printed at C-style escapes, or as
115three octal digits, if no C escape exists for the character.
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 hexdump(1).
218.Pp
219.Cm c
220selects a standard character based conversion.
221See also the
222.Cm _c
223conversion provided by hexdump(1).
224.Pp
225.Cm f
226selects the floating point output format.
227This type character can be optionally followed by the characters
228.Cm 4
229or
230.Cm F
231to specify four byte floating point output, or
232.Cm 8
233or
234.Cm L
235to specify eight byte floating point output.
236The default output format is eight byte floats.
237See also the
238.Cm e
239conversion provided by hexdump(1).
240.Pp
241.Cm d ,
242.Cm o ,
243.Cm u ,
244or
245.Cm x
246select decimal, octal, unsigned decimal, or hex output respectively.
247These types can optionally be followed by
248.Cm C
249to specify
250.Em char Ns -sized
251output,
252.Cm S
253to specify
254.Em short Ns -sized
255output,
256.Cm I
257to specify
258.Em int Ns -sized
259output,
260.Cm L
261to specify
262.Em long Ns -sized
263output,
264.Cm 1
265to specify one-byte output,
266.Cm 2
267to specify two-byte output,
268.Cm 4
269to specify four-byte output, or
270.Cm 8
271to specify eight-byte output.
272The default output format is in four-byte quantities.
273See also the
274.Cm d ,
275.Cm o ,
276.Cm u ,
277and
278.Cm x
279conversions provided by hexdump(1).
280.\"(a|c|f[FLD]?|[doux][C1S2I4L8]?)*
281.It Fl v
282The
283.Fl v
284option causes
285.Nm
286to display all input data.
287Without the
288.Fl v
289option, any number of groups of output lines, which would be
290identical to the immediately preceding group of output lines (except
291for the input offsets), are replaced with a line comprised of a
292single asterisk.
293.It Fl X
294Same as
295.Fl H .
296.It Fl x
297Same as
298.Fl h .
299.El
300.Pp
301For each input file,
302.Nm
303sequentially copies the input to standard output, transforming the
304data according to the options given.
305If no options are specified, the
306default display is equivalent to specifying the
307.Fl o
308option.
309.Pp
310.Nm
311exits 0 on success and \*[Gt]0 if an error occurred.
312.Sh SEE ALSO
313.Xr hexdump 1 ,
314.Xr strings 1
315.Sh HISTORY
316A
317.Nm
318command appears in
319.At v1 .
320.Pp
321This man page was written in February 2001 by Andrew Brown, shortly
322after he augmented the deprecated od syntax to include things he felt
323had been missing for a long time.
324