xref: /freebsd/usr.bin/hexdump/od.1 (revision eb69d1f144a6fcc765d1b9d44a5ae8082353e70b)
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.\"	@(#)od.1	8.1 (Berkeley) 6/6/93
29.\" $FreeBSD$
30.\"
31.Dd December 22, 2011
32.Dt OD 1
33.Os
34.Sh NAME
35.Nm od
36.Nd octal, decimal, hex, ASCII dump
37.Sh SYNOPSIS
38.Nm
39.Op Fl aBbcDdeFfHhIiLlOosvXx
40.Op Fl A Ar base
41.Op Fl j Ar skip
42.Op Fl N Ar length
43.Op Fl t Ar type
44.Op Oo Cm + Oc Ns Ar offset Ns Oo Cm \&. Oc Ns Op Cm Bb
45.Op Ar
46.Sh DESCRIPTION
47The
48.Nm
49utility is a filter which displays the specified files, or standard
50input if no files are specified, in a user specified format.
51.Pp
52The options are as follows:
53.Bl -tag -width ".Fl I , L , l"
54.It Fl A Ar base
55Specify the input address base.
56The argument
57.Ar base
58may be one of
59.Cm d ,
60.Cm o ,
61.Cm x
62or
63.Cm n ,
64which specify decimal, octal, hexadecimal
65addresses or no address, respectively.
66.It Fl a
67Output named characters.
68Equivalent to
69.Fl t Cm a .
70.It Fl B , o
71Output octal shorts.
72Equivalent to
73.Fl t Cm o2 .
74.It Fl b
75Output octal bytes.
76Equivalent to
77.Fl t Cm o1 .
78.It Fl c
79Output C-style escaped characters.
80Equivalent to
81.Fl t Cm c .
82.It Fl D
83Output unsigned decimal ints.
84Equivalent to
85.Fl t Cm u4 .
86.It Fl d
87Output unsigned decimal shorts.
88Equivalent to
89.Fl t Cm u2 .
90.It Fl e , F
91Output double-precision floating point numbers.
92Equivalent to
93.Fl t Cm fD .
94.It Fl f
95Output single-precision floating point numbers.
96Equivalent to
97.Fl t Cm fF .
98.It Fl H , X
99Output hexadecimal ints.
100Equivalent to
101.Fl t Cm x4 .
102.It Fl h , x
103Output hexadecimal shorts.
104Equivalent to
105.Fl t Cm x2 .
106.It Fl I , L , l
107Output signed decimal longs.
108Equivalent to
109.Fl t Cm dL .
110.It Fl i
111Output signed decimal ints.
112Equivalent to
113.Fl t Cm dI .
114.It Fl j Ar skip
115Skip
116.Ar skip
117bytes of the combined input before dumping.
118The number may be followed by one
119of
120.Cm b , k
121or
122.Cm m
123which specify the units of the number as blocks (512 bytes), kilobytes and
124megabytes, respectively.
125.It Fl N Ar length
126Dump at most
127.Ar length
128bytes of input.
129.It Fl O
130Output octal ints.
131Equivalent to
132.Fl t Cm o4 .
133.It Fl s
134Output signed decimal shorts.
135Equivalent to
136.Fl t Cm d2 .
137.It Fl t Ar type
138Specify the output format.
139The
140.Ar type
141argument
142is a string containing one or more of the following kinds of type specifiers:
143.Bl -tag -width indent
144.It Cm a
145Named characters
146.Pq Tn ASCII .
147Control characters are displayed using the following names:
148.Bl -column "000 NUL" "001 SOH" "002 STX" "003 ETX" "004 EOT" "005 ENQ"
149.It "000 NUL	001 SOH	002 STX	003 ETX	004 EOT	005 ENQ"
150.It "006 ACK	007 BEL	008 BS	009 HT	00A NL	00B VT"
151.It "00C FF	00D CR	00E SO	00F SI	010 DLE	011 DC1"
152.It "012 DC2	013 DC3	014 DC4	015 NAK	016 SYN	017 ETB"
153.It "018 CAN	019 EM	01A SUB	01B ESC	01C FS	01D GS"
154.It "01E RS	01F US	020 SP	07F DEL	\&	\&"
155.El
156.It Cm c
157Characters in the default character set.
158Non-printing characters are
159represented as 3-digit octal character codes, except the following
160characters, which are represented as C escapes:
161.Pp
162.Bl -tag -width carriage-return -compact
163.It NUL
164\e0
165.It alert
166\ea
167.It backspace
168\eb
169.It newline
170\en
171.It carriage-return
172\er
173.It tab
174\et
175.It vertical tab
176\ev
177.El
178.Pp
179Multi-byte characters are displayed in the area corresponding to the first
180byte of the character.
181The remaining bytes are shown as
182.Ql ** .
183.It Xo
184.Sm off
185.Op Cm d | o | u | x
186.Op Cm C | S | I | L | Ar n
187.Sm on
188.Xc
189Signed decimal
190.Pq Cm d ,
191octal
192.Pq Cm o ,
193unsigned decimal
194.Pq Cm u
195or
196hexadecimal
197.Pq Cm x .
198Followed by an optional size specifier, which may be either
199.Cm C
200.Pq Vt char ,
201.Cm S
202.Pq Vt short ,
203.Cm I
204.Pq Vt int ,
205.Cm L
206.Pq Vt long ,
207or a byte count as a decimal integer.
208.It Xo
209.Sm off
210.Cm f
211.Op Cm F | D | L | Ar n
212.Sm on
213.Xc
214Floating-point number.
215Followed by an optional size specifier, which may be either
216.Cm F
217.Pq Vt float ,
218.Cm D
219.Pq Vt double
220or
221.Cm L
222.Pq Vt "long double" .
223.El
224.It Fl v
225Write all input data, instead of replacing lines of duplicate values with a
226.Ql * .
227.El
228.Pp
229Multiple options that specify output format may be used; the output will
230contain one line for each format.
231.Pp
232If no output format is specified,
233.Fl t Cm oS
234is assumed.
235.Sh ENVIRONMENT
236The
237.Ev LANG , LC_ALL
238and
239.Ev LC_CTYPE
240environment variables affect the execution of
241.Nm
242as described in
243.Xr environ 7 .
244.Sh EXIT STATUS
245.Ex -std
246.Sh COMPATIBILITY
247The traditional
248.Fl s
249option to extract string constants is not supported; consider using
250.Xr strings 1
251instead.
252.Sh SEE ALSO
253.Xr hexdump 1 ,
254.Xr strings 1
255.Sh STANDARDS
256The
257.Nm
258utility conforms to
259.St -p1003.1-2001 .
260.Sh HISTORY
261An
262.Nm
263command appeared in
264.At v1 .
265