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