xref: /netbsd/usr.bin/hexdump/od.1 (revision bf9ec67e)
1.\"  $NetBSD: od.1,v 1.17 2002/02/08 01:36:24 ross 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.  Control characters are printed as their names instead of as
92c style escapes.
93.It Fl B
94Same as
95.Fl o .
96.It Fl b
97.Em One-byte octal display .
98Display the input offset in octal, followed by sixteen
99space-separated, three column, zero-filled, bytes of input data, in
100octal, per line.  This is the default output style if no other is
101selected.
102.It Fl c
103.Em One-byte character display .
104Display the input offset in octal, followed by sixteen
105space-separated, three column, space-filled, characters of input data
106per line.  Control characters are printed at c style escapes, or as
107three octal digits, if no c escape exists for the character.
108.It Fl d
109.Em Two-byte decimal display .
110Display the input offset in octal, followed by eight
111space-separated, five column, zero-filled, two-byte units
112of input data, in unsigned decimal, per line.
113.It Fl e
114.Em Eight-byte floating point display .
115Display the input offset in octal, followed by two space-separated,
116twenty-one column, space filled, eight byte units of input data, in
117floating point, per line.
118.It Fl F
119Same as
120.Fl e .
121.It Fl f
122.Em Four-byte floating point display .
123Display the input offset in octal, followed by four space-separated,
12414 column, space filled, four byte units of input data, in floating
125point, per line.
126.It Fl H
127.Em Four-byte hex display .
128Display the input offset in octal, followed by four space-separated,
129eight column, zero filled, four byte units of input data, in hex,
130per line.
131.It Fl h
132.Em Two-byte hex display .
133Display the input offset in octal, followed by eight space-separated,
134four column, zero filled, two byte units of input data, in hex,
135per line.
136.It Fl I
137.Em Four-byte decimal display .
138Display the input offset in octal, followed by four space-separated,
139eleven column, space filled, four byte units of input data, in
140decimal, per line.
141.It Fl i
142.Em Two-byte decimal display .
143Display the input offset in octal, followed by eight space-separated,
144six column, space filled, two-byte units of input data, in decimal,
145per line.
146.It Fl j Ar offset
147Skip
148.Ar offset
149bytes from the beginning of the input.
150By default,
151.Ar offset
152is interpreted as a decimal number.
153With a leading
154.Cm 0x
155or
156.Cm 0X ,
157.Ar offset
158is interpreted as a hexadecimal number,
159otherwise, with a leading
160.Cm 0 ,
161.Ar offset
162is interpreted as an octal number.
163Appending the character
164.Cm b ,
165.Cm k ,
166or
167.Cm m
168to
169.Ar offset
170causes it to be interpreted as a multiple of
171.Li 512 ,
172.Li 1024 ,
173or
174.Li 1048576 ,
175respectively.
176.It Fl L
177Same as
178.Fl I .
179.It Fl l
180Same as
181.Fl I .
182.It Fl N Ar length
183Interpret only
184.Ar length
185bytes of input.
186.It Fl O
187.Em Four-byte octal display .
188Display the input offset in octal, followed by four
189space-separated, eleven column, zero-filled, four-byte units
190of input data, in octal, per line.
191.It Fl o
192.Em Two-byte octal display .
193Display the input offset in octal, followed by eight
194space-separated, six column, zero-filled, two-byte units
195of input data, in octal, per line.
196.It Fl t Ar type_string
197Specify one or more output types.  The
198.Em type_string
199option-argument must be a string specifying the types to be used when
200writing the input data.  The string must consist of the type
201specification characters:
202.Pp
203.Cm a
204selects US-ASCII output, with control characters replaced with their
205names instead of as c escape sequences.  See also the
206.Cm _u
207conversion provided by hexdump(1).
208.Pp
209.Cm c
210selects a standard character based conversion.  See also the
211.Cm _c
212conversion provided by hexdump(1).
213.Pp
214.Cm f
215selects the floating point output format.  This type character can be
216optionally followed by the characters
217.Cm 4
218or
219.Cm F
220to specify four byte floating point output, or
221.Cm 8
222or
223.Cm L
224to specify eight byte floating point output.  The default output
225format is eight byte floats.  See also the
226.Cm e
227conversion provided by hexdump(1).
228.Pp
229.Cm d ,
230.Cm o ,
231.Cm u ,
232or
233.Cm x
234select decimal, octal, unsigned decimal, or hex output respectively.
235These types can optionally be followed by
236.Cm C
237to specify
238.Em char Ns -sized
239output,
240.Cm S
241to specify
242.Em short Ns -sized
243output,
244.Cm I
245to specify
246.Em int Ns -sized
247output,
248.Cm L
249to specify
250.Em long Ns -sized
251output,
252.Cm 1
253to specify one-byte output,
254.Cm 2
255to specify two-byte output,
256.Cm 4
257to specify four-byte output, or
258.Cm 8
259to specify eight-byte output.  The default output format is in
260four-byte quantities.  See also the
261.Cm d ,
262.Cm o ,
263.Cm u ,
264and
265.Cm x
266conversions provided by 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.It Fl X
281Same as
282.Fl H .
283.It Fl x
284Same as
285.Fl h .
286.El
287.Pp
288For each input file,
289.Nm
290sequentially copies the input to standard output, transforming the
291data according to the options given.  If no options are specified, the
292default display is equivalent to specifying the
293.Fl o
294option.
295.Pp
296.Nm
297exits 0 on success and \*[Gt]0 if an error occurred.
298.Sh SEE ALSO
299.Xr hexdump 1 ,
300.Xr strings 1
301.Sh HISTORY
302A
303.Nm
304command appears in
305.At v1 .
306.Pp
307This man page was written in February 2001 by Andrew Brown, shortly
308after he augmented the deprecated od syntax to include things he felt
309had been missing for a long time.
310