]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/hexdump/od.1
zfs: merge openzfs/zfs@229b9f4ed
[FreeBSD/FreeBSD.git] / usr.bin / hexdump / od.1
1 .\" Copyright (c) 1990, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .Dd December 22, 2011
29 .Dt OD 1
30 .Os
31 .Sh NAME
32 .Nm od
33 .Nd octal, decimal, hex, ASCII dump
34 .Sh SYNOPSIS
35 .Nm
36 .Op Fl aBbcDdeFfHhIiLlOosvXx
37 .Op Fl A Ar base
38 .Op Fl j Ar skip
39 .Op Fl N Ar length
40 .Op Fl t Ar type
41 .Op Oo Cm + Oc Ns Ar offset Ns Oo Cm \&. Oc Ns Op Cm Bb
42 .Op Ar
43 .Sh DESCRIPTION
44 The
45 .Nm
46 utility is a filter which displays the specified files, or standard
47 input if no files are specified, in a user specified format.
48 .Pp
49 The options are as follows:
50 .Bl -tag -width ".Fl I , L , l"
51 .It Fl A Ar base
52 Specify the input address base.
53 The argument
54 .Ar base
55 may be one of
56 .Cm d ,
57 .Cm o ,
58 .Cm x
59 or
60 .Cm n ,
61 which specify decimal, octal, hexadecimal
62 addresses or no address, respectively.
63 .It Fl a
64 Output named characters.
65 Equivalent to
66 .Fl t Cm a .
67 .It Fl B , o
68 Output octal shorts.
69 Equivalent to
70 .Fl t Cm o2 .
71 .It Fl b
72 Output octal bytes.
73 Equivalent to
74 .Fl t Cm o1 .
75 .It Fl c
76 Output C-style escaped characters.
77 Equivalent to
78 .Fl t Cm c .
79 .It Fl D
80 Output unsigned decimal ints.
81 Equivalent to
82 .Fl t Cm u4 .
83 .It Fl d
84 Output unsigned decimal shorts.
85 Equivalent to
86 .Fl t Cm u2 .
87 .It Fl e , F
88 Output double-precision floating point numbers.
89 Equivalent to
90 .Fl t Cm fD .
91 .It Fl f
92 Output single-precision floating point numbers.
93 Equivalent to
94 .Fl t Cm fF .
95 .It Fl H , X
96 Output hexadecimal ints.
97 Equivalent to
98 .Fl t Cm x4 .
99 .It Fl h , x
100 Output hexadecimal shorts.
101 Equivalent to
102 .Fl t Cm x2 .
103 .It Fl I , L , l
104 Output signed decimal longs.
105 Equivalent to
106 .Fl t Cm dL .
107 .It Fl i
108 Output signed decimal ints.
109 Equivalent to
110 .Fl t Cm dI .
111 .It Fl j Ar skip
112 Skip
113 .Ar skip
114 bytes of the combined input before dumping.
115 The number may be followed by one
116 of
117 .Cm b , k
118 or
119 .Cm m
120 which specify the units of the number as blocks (512 bytes), kilobytes and
121 megabytes, respectively.
122 .It Fl N Ar length
123 Dump at most
124 .Ar length
125 bytes of input.
126 .It Fl O
127 Output octal ints.
128 Equivalent to
129 .Fl t Cm o4 .
130 .It Fl s
131 Output signed decimal shorts.
132 Equivalent to
133 .Fl t Cm d2 .
134 .It Fl t Ar type
135 Specify the output format.
136 The
137 .Ar type
138 argument
139 is a string containing one or more of the following kinds of type specifiers:
140 .Bl -tag -width indent
141 .It Cm a
142 Named characters
143 .Pq ASCII .
144 Control characters are displayed using the following names:
145 .Bl -column "000 NUL" "001 SOH" "002 STX" "003 ETX" "004 EOT" "005 ENQ"
146 .It "000 NUL    001 SOH 002 STX 003 ETX 004 EOT 005 ENQ"
147 .It "006 ACK    007 BEL 008 BS  009 HT  00A NL  00B VT"
148 .It "00C FF     00D CR  00E SO  00F SI  010 DLE 011 DC1"
149 .It "012 DC2    013 DC3 014 DC4 015 NAK 016 SYN 017 ETB"
150 .It "018 CAN    019 EM  01A SUB 01B ESC 01C FS  01D GS"
151 .It "01E RS     01F US  020 SP  07F DEL \&      \&"
152 .El
153 .It Cm c
154 Characters in the default character set.
155 Non-printing characters are
156 represented as 3-digit octal character codes, except the following
157 characters, which are represented as C escapes:
158 .Pp
159 .Bl -tag -width carriage-return -compact
160 .It NUL
161 \e0
162 .It alert
163 \ea
164 .It backspace
165 \eb
166 .It newline
167 \en
168 .It carriage-return
169 \er
170 .It tab
171 \et
172 .It vertical tab
173 \ev
174 .El
175 .Pp
176 Multi-byte characters are displayed in the area corresponding to the first
177 byte of the character.
178 The remaining bytes are shown as
179 .Ql ** .
180 .It Xo
181 .Sm off
182 .Op Cm d | o | u | x
183 .Op Cm C | S | I | L | Ar n
184 .Sm on
185 .Xc
186 Signed decimal
187 .Pq Cm d ,
188 octal
189 .Pq Cm o ,
190 unsigned decimal
191 .Pq Cm u
192 or
193 hexadecimal
194 .Pq Cm x .
195 Followed by an optional size specifier, which may be either
196 .Cm C
197 .Pq Vt char ,
198 .Cm S
199 .Pq Vt short ,
200 .Cm I
201 .Pq Vt int ,
202 .Cm L
203 .Pq Vt long ,
204 or a byte count as a decimal integer.
205 .It Xo
206 .Sm off
207 .Cm f
208 .Op Cm F | D | L | Ar n
209 .Sm on
210 .Xc
211 Floating-point number.
212 Followed by an optional size specifier, which may be either
213 .Cm F
214 .Pq Vt float ,
215 .Cm D
216 .Pq Vt double
217 or
218 .Cm L
219 .Pq Vt "long double" .
220 .El
221 .It Fl v
222 Write all input data, instead of replacing lines of duplicate values with a
223 .Ql * .
224 .El
225 .Pp
226 Multiple options that specify output format may be used; the output will
227 contain one line for each format.
228 .Pp
229 If no output format is specified,
230 .Fl t Cm oS
231 is assumed.
232 .Sh ENVIRONMENT
233 The
234 .Ev LANG , LC_ALL
235 and
236 .Ev LC_CTYPE
237 environment variables affect the execution of
238 .Nm
239 as described in
240 .Xr environ 7 .
241 .Sh EXIT STATUS
242 .Ex -std
243 .Sh EXAMPLES
244 Dump stdin and show the output using named characters and C-style escaped
245 characters:
246 .Bd -literal -offset indent
247 $ echo "FreeBSD: The power to serve" | od -a -c
248 0000000    F   r   e   e   B   S   D   :  sp   T   h   e  sp   p   o   w
249            F   r   e   e   B   S   D   :       T   h   e       p   o   w
250 0000020    e   r  sp   t   o  sp   s   e   r   v   e  nl
251            e   r       t   o       s   e   r   v   e  \en
252 0000034
253 .Ed
254 .Pp
255 Dump stdin skipping the first 13 bytes using named characters and dumping no
256 more than 5 bytes:
257 .Bd -literal -offset indent
258 $ echo "FreeBSD: The power to serve" | od -An -a -j 13 -N 5
259            p   o   w   e   r
260 .Ed
261 .Sh COMPATIBILITY
262 The traditional
263 .Fl s
264 option to extract string constants is not supported; consider using
265 .Xr strings 1
266 instead.
267 .Sh SEE ALSO
268 .Xr hexdump 1 ,
269 .Xr strings 1
270 .Sh STANDARDS
271 The
272 .Nm
273 utility conforms to
274 .St -p1003.1-2001 .
275 .Sh HISTORY
276 An
277 .Nm
278 command appeared in
279 .At v1 .