xref: /freebsd/usr.bin/hexdump/od.1 (revision 9336e0699bda8a301cd2bfa37106b6ec5e32012e)
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$
34.\"
35.Dd December 24, 2006
36.Os
37.Dt OD 1
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.Op Oo Cm + Oc Ns Ar offset Ns Oo Cm \&. Oc Ns Op Cm Bb
49.Op Ar
50.Sh DESCRIPTION
51The
52.Nm
53utility is a filter which displays the specified files, or standard
54input if no files are specified, in a user specified format.
55.Pp
56The options are as follows:
57.Bl -tag -width ".Fl I , L , l"
58.It Fl A Ar base
59Specify the input address base.
60The argument
61.Ar base
62may be one of
63.Cm d ,
64.Cm o ,
65.Cm x
66or
67.Cm n ,
68which specify decimal, octal, hexadecimal
69addresses or no address, respectively.
70.It Fl a
71Output named characters.
72Equivalent to
73.Fl t Cm a .
74.It Fl B , o
75Output octal shorts.
76Equivalent to
77.Fl t Cm o2 .
78.It Fl b
79Output octal bytes.
80Equivalent to
81.Fl t Cm o1 .
82.It Fl c
83Output C-style escaped characters.
84Equivalent to
85.Fl t Cm c .
86.It Fl D
87Output unsigned decimal ints.
88Equivalent to
89.Fl t Cm u4 .
90.It Fl d
91Output unsigned decimal shorts.
92Equivalent to
93.Fl t Cm u2 .
94.It Fl e , F
95Output double-precision floating point numbers.
96Equivalent to
97.Fl t Cm fD .
98.It Fl f
99Output single-precision floating point numbers.
100Equivalent to
101.Fl t Cm fF .
102.It Fl H , X
103Output hexadecimal ints.
104Equivalent to
105.Fl t Cm x4 .
106.It Fl h , x
107Output hexadecimal shorts.
108Equivalent to
109.Fl t Cm x2 .
110.It Fl I , L , l
111Output signed decimal longs.
112Equivalent to
113.Fl t Cm dL .
114.It Fl i
115Output signed decimal ints.
116Equivalent to
117.Fl t Cm dI .
118.It Fl j Ar skip
119Skip
120.Ar skip
121bytes of the combined input before dumping.
122The number may be followed by one
123of
124.Cm b , k
125or
126.Cm m
127which specify the units of the number as blocks (512 bytes), kilobytes and
128megabytes, respectively.
129.It Fl N Ar length
130Dump at most
131.Ar length
132bytes of input.
133.It Fl O
134Output octal ints.
135Equivalent to
136.Fl t Cm o4 .
137.It Fl s
138Output signed decimal shorts.
139Equivalent to
140.Fl t Cm d2 .
141.It Fl t Ar type
142Specify the output format.
143The
144.Ar type
145argument
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.Pp
183Multi-byte characters are displayed in the area corresponding to the first
184byte of the character.
185The remaining bytes are shown as
186.Ql ** .
187.It Xo
188.Sm off
189.Op Cm d | o | u | x
190.Op Cm C | S | I | L | Ar n
191.Sm on
192.Xc
193Signed decimal
194.Pq Cm d ,
195octal
196.Pq Cm o ,
197unsigned decimal
198.Pq Cm u
199or
200hexadecimal
201.Pq Cm x .
202Followed by an optional size specifier, which may be either
203.Cm C
204.Pq Vt char ,
205.Cm S
206.Pq Vt short ,
207.Cm I
208.Pq Vt int ,
209.Cm L
210.Pq Vt long ,
211or a byte count as a decimal integer.
212.It Xo
213.Sm off
214.Cm f
215.Op Cm F | D | L | Ar n
216.Sm on
217.Xc
218Floating-point number.
219Followed by an optional size specifier, which may be either
220.Cm F
221.Pq Vt float ,
222.Cm D
223.Pq Vt double
224or
225.Cm L
226.Pq Vt "long double" .
227.El
228.It Fl v
229Write all input data, instead of replacing lines of duplicate values with a
230.Ql * .
231.El
232.Pp
233Multiple options that specify output format may be used; the output will
234contain one line for each format.
235.Pp
236If no output format is specified,
237.Fl t Cm oS
238is assumed.
239.Sh ENVIRONMENT
240The
241.Ev LANG , LC_ALL
242and
243.Ev LC_CTYPE
244environment variables affect the execution of
245.Nm
246as described in
247.Xr environ 7 .
248.Sh EXIT STATUS
249.Ex -std
250.Sh COMPATIBILITY
251The traditional
252.Fl s
253option to extract string constants is not supported; consider using
254.Xr strings 1
255instead.
256.Sh SEE ALSO
257.Xr hexdump 1 ,
258.Xr strings 1
259.Sh STANDARDS
260The
261.Nm
262utility conforms to
263.St -p1003.1-2001 .
264.Sh HISTORY
265An
266.Nm
267command appeared in
268.At v1 .
269