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