Annotation of src/usr.bin/hexdump/od.1, Revision 1.32
1.32 ! schwarze 1: .\" $OpenBSD: od.1,v 1.31 2015/09/16 08:47:26 schwarze 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.32 ! schwarze 31: .Dd $Mdocdate: September 16 2015 $
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
1.27 sobrado 39: .Op Fl aBbcDdeFfHhIiLlOosvXx
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.14 jmc 44: .Op Ar
1.1 deraadt 45: .Sh DESCRIPTION
1.26 sobrado 46: The
1.5 aaron 47: .Nm
1.26 sobrado 48: utility is a filter which displays the specified files, or standard
49: input if no files are specified, in a user specified format.
1.9 pvalchev 50: .Pp
51: The options are as follows:
1.32 ! schwarze 52: .Bl -tag -width Ds
1.22 fgsch 53: .It Fl A Ar base
54: Specify the input address base.
55: The argument
56: .Ar base
57: may be one of
58: .Cm d ,
59: .Cm o ,
60: .Cm x ,
61: or
62: .Cm n ,
63: which specify decimal, octal, hexadecimal
64: addresses or no address, respectively.
1.9 pvalchev 65: .It Fl a
66: .Em One-byte character display .
67: Display the input offset in octal, followed by sixteen
68: space-separated, three column, space-filled, characters of input data
1.12 jmc 69: per line.
70: Control characters are printed as their names instead of as C-style escapes.
1.9 pvalchev 71: .It Fl B
72: Same as
73: .Fl o .
74: .It Fl b
75: .Em One-byte octal display .
76: Display the input offset in octal, followed by sixteen
77: space-separated, three column, zero-filled, bytes of input data, in
1.12 jmc 78: octal, per line.
79: This is the default output style if no other is selected.
1.9 pvalchev 80: .It Fl c
81: .Em One-byte character display .
82: Display the input offset in octal, followed by sixteen
83: space-separated, three column, space-filled, characters of input data
1.12 jmc 84: per line.
85: Control characters are printed as c style escapes, or as three octal digits,
86: if no c escape exists for the character.
1.15 otto 87: .It Fl D
1.16 jmc 88: .Em Four-byte octal display .
1.15 otto 89: Display the input offset in octal, followed by four space-separated,
90: ten column, space filled, four-byte units of input data, in octal, per line.
1.9 pvalchev 91: .It Fl d
1.27 sobrado 92: .Em Two-byte unsigned decimal display .
1.9 pvalchev 93: Display the input offset in octal, followed by eight
94: space-separated, five column, zero-filled, two-byte units
95: of input data, in unsigned decimal, per line.
96: .It Fl e
97: .Em Eight-byte floating point display .
98: Display the input offset in octal, followed by two space-separated,
1.17 otto 99: twenty-one column, space filled, eight-byte units of input data, in
1.9 pvalchev 100: floating point, per line.
101: .It Fl F
102: Same as
103: .Fl e .
104: .It Fl f
105: .Em Four-byte floating point display .
106: Display the input offset in octal, followed by four space-separated,
1.17 otto 107: 14 column, space filled, four-byte units of input data, in floating
1.9 pvalchev 108: point, per line.
109: .It Fl H
110: .Em Four-byte hex display .
111: Display the input offset in octal, followed by four space-separated,
1.17 otto 112: eight column, zero filled, four-byte units of input data, in hex,
1.9 pvalchev 113: per line.
114: .It Fl h
115: .Em Two-byte hex display .
116: Display the input offset in octal, followed by eight space-separated,
1.17 otto 117: four column, zero filled, two-byte units of input data, in hex,
1.9 pvalchev 118: per line.
119: .It Fl I
120: .Em Four-byte decimal display .
121: Display the input offset in octal, followed by four space-separated,
1.17 otto 122: eleven column, space filled, four-byte units of input data, in
1.9 pvalchev 123: decimal, per line.
124: .It Fl i
125: .Em Two-byte decimal display .
126: Display the input offset in octal, followed by eight space-separated,
127: six column, space filled, two-byte units of input data, in decimal,
128: per line.
129: .It Fl j Ar offset
130: Skip
131: .Ar offset
132: bytes from the beginning of the input.
133: By default,
134: .Ar offset
135: is interpreted as a decimal number.
136: With a leading
137: .Cm 0x
138: or
139: .Cm 0X ,
140: .Ar offset
141: is interpreted as a hexadecimal number,
142: otherwise, with a leading
143: .Cm 0 ,
144: .Ar offset
145: is interpreted as an octal number.
146: Appending the character
147: .Cm b ,
148: .Cm k ,
149: or
150: .Cm m
151: to
152: .Ar offset
153: causes it to be interpreted as a multiple of
154: .Li 512 ,
155: .Li 1024 ,
156: or
157: .Li 1048576 ,
158: respectively.
1.31 schwarze 159: .Pp
160: As an alternative to
161: .Nm
162: .Fl j Ar offset
163: .Op Ar file ,
164: the X/Open System Interfaces syntax
165: .Nm
166: .Op Ar file
167: .Sm off
168: .Op Cm \&+
169: .Ar offset
170: .Op Cm \&.
171: .Op Cm Bb
172: .Sm on
173: is also supported.
1.9 pvalchev 174: .It Fl L
175: Same as
176: .Fl I .
177: .It Fl l
178: Same as
179: .Fl I .
180: .It Fl N Ar length
181: Interpret only
182: .Ar length
183: bytes of input.
184: .It Fl O
185: .Em Four-byte octal display .
186: Display the input offset in octal, followed by four
187: space-separated, eleven column, zero-filled, four-byte units
188: of input data, in octal, per line.
189: .It Fl o
190: .Em Two-byte octal display .
191: Display the input offset in octal, followed by eight
192: space-separated, six column, zero-filled, two-byte units
193: of input data, in octal, per line.
1.27 sobrado 194: .It Fl s
195: .Em Two-byte signed decimal display .
196: Display the input offset in octal, followed by eight
197: space-separated, five column, zero-filled, two-byte units
198: of input data, in signed decimal, per line.
1.9 pvalchev 199: .It Fl t Ar type_string
1.12 jmc 200: Specify one or more output types.
201: The
1.9 pvalchev 202: .Em type_string
203: option-argument must be a string specifying the types to be used when
1.12 jmc 204: writing the input data.
205: The string must consist of the type specification characters:
1.9 pvalchev 206: .Pp
207: .Cm a
208: selects US-ASCII output, with control characters replaced with their
1.12 jmc 209: names instead of as c escape sequences.
210: See also the
1.9 pvalchev 211: .Cm _u
1.12 jmc 212: conversion provided by
213: .Xr hexdump 1 .
1.9 pvalchev 214: .Pp
215: .Cm c
1.12 jmc 216: selects a standard character based conversion.
217: See also the
1.9 pvalchev 218: .Cm _c
1.12 jmc 219: conversion provided by
220: .Xr hexdump 1 .
1.9 pvalchev 221: .Pp
222: .Cm f
1.12 jmc 223: selects the floating point output format.
224: This type character can be optionally followed by the characters
1.9 pvalchev 225: .Cm 4
226: or
227: .Cm F
1.17 otto 228: to specify four-byte floating point output, or
1.9 pvalchev 229: .Cm 8
230: or
231: .Cm L
1.17 otto 232: to specify eight-byte floating point output.
233: The default output format is eight-byte floats.
1.12 jmc 234: See also the
1.9 pvalchev 235: .Cm e
1.12 jmc 236: conversion provided by
237: .Xr hexdump 1 .
1.9 pvalchev 238: .Pp
239: .Cm d ,
240: .Cm o ,
241: .Cm u ,
242: or
243: .Cm x
244: select decimal, octal, unsigned decimal, or hex output respectively.
245: These types can optionally be followed by
246: .Cm C
247: to specify
248: .Em char Ns -sized
249: output,
250: .Cm S
251: to specify
252: .Em short Ns -sized
253: output,
254: .Cm I
255: to specify
256: .Em int Ns -sized
257: output,
258: .Cm L
259: to specify
260: .Em long Ns -sized
261: output,
262: .Cm 1
263: to specify one-byte output,
264: .Cm 2
265: to specify two-byte output,
266: .Cm 4
267: to specify four-byte output, or
268: .Cm 8
1.12 jmc 269: to specify eight-byte output.
270: The default output format is in four-byte quantities.
271: See also the
1.9 pvalchev 272: .Cm d ,
273: .Cm o ,
274: .Cm u ,
275: and
276: .Cm x
1.12 jmc 277: conversions provided by
278: .Xr hexdump 1 .
1.9 pvalchev 279: .\"(a|c|f[FLD]?|[doux][C1S2I4L8]?)*
280: .It Fl v
281: The
282: .Fl v
283: option causes
284: .Nm
285: to display all input data.
286: Without the
287: .Fl v
288: option, any number of groups of output lines, which would be
289: identical to the immediately preceding group of output lines (except
290: for the input offsets), are replaced with a line comprised of a
291: single asterisk.
292: .It Fl X
293: Same as
294: .Fl H .
295: .It Fl x
296: Same as
297: .Fl h .
298: .El
299: .Pp
300: For each input file,
301: .Nm
302: sequentially copies the input to standard output, transforming the
1.12 jmc 303: data according to the options given.
304: If no options are specified, the default display is equivalent to
305: specifying the
1.9 pvalchev 306: .Fl o
307: option.
1.23 jmc 308: .Sh EXIT STATUS
1.13 jmc 309: .Ex -std od
1.1 deraadt 310: .Sh SEE ALSO
1.27 sobrado 311: .Xr hexdump 1
1.28 sobrado 312: .Sh STANDARDS
1.18 jmc 313: The
314: .Nm
315: utility is compliant with the
1.21 jmc 316: .St -p1003.1-2008
1.18 jmc 317: specification.
1.29 jmc 318: .Pp
319: The flags
320: .Op Fl bcdosx
321: as well as the
322: .Ar offset
323: specifier are marked by
324: .St -p1003.1-2008
325: as being an
326: X/Open System Interfaces
327: option.
1.18 jmc 328: .Pp
329: The flags
330: .Op Fl aBDeFfHhIiLlOX
331: are extensions to that specification.
1.28 sobrado 332: .Sh HISTORY
1.25 jmc 333: An
1.9 pvalchev 334: .Nm
335: command appears in
336: .At v1 .
337: .Pp
338: This man page was written in February 2001 by Andrew Brown, shortly
1.30 sobrado 339: after he augmented the
340: .Nm
341: syntax to include things he felt had been missing for a long time.