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