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