NetBSD/usr.bin/hexdump/od.1

319 lines
8.1 KiB
Groff
Raw Normal View History

.\" $NetBSD: od.1,v 1.21 2003/02/25 10:35:43 wiz Exp $
1997-01-09 23:18:21 +03:00
.\"
2001-02-09 20:50:44 +03:00
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Andrew Brown.
1993-03-21 12:45:37 +03:00
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
2001-02-09 20:50:44 +03:00
.\" This product includes software developed by the NetBSD
.\" Foundation, Inc. and its contributors.
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
1993-03-21 12:45:37 +03:00
.\"
2001-02-09 20:50:44 +03:00
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"/
.Dd February 9, 2001
1993-03-21 12:45:37 +03:00
.Dt OD 1
2001-02-09 20:50:44 +03:00
.Os
1993-03-21 12:45:37 +03:00
.Sh NAME
.Nm od
.Nd octal, decimal, hex, ascii dump
.Sh SYNOPSIS
.Nm
1993-03-21 12:45:37 +03:00
.Op Fl aBbcDdeFfHhIiLlOovXx
2001-02-07 21:31:07 +03:00
.Bk -words
.Op Fl j Ar skip
.Ek
.Bk -words
.Op Fl N Ar length
.Ek
.Bk -words
2001-02-07 21:31:07 +03:00
.Op Fl t Ar type_string
.Ek
2001-02-09 20:50:44 +03:00
.Sm off
1993-03-21 12:45:37 +03:00
.Oo
.Op Cm \&+
.Li offset
.Op Cm \&.
.Op Cm Bb
2001-02-09 20:50:44 +03:00
.Sm on
1993-03-21 12:45:37 +03:00
.Oc
2001-02-09 20:50:44 +03:00
.Ar file ...
1993-03-21 12:45:37 +03:00
.Sh DESCRIPTION
.Nm
1993-03-21 12:45:37 +03:00
has been deprecated in favor of
.Xr hexdump 1 .
.Pp
2001-04-04 13:36:33 +04:00
.Xr hexdump 1 ,
1993-03-21 12:45:37 +03:00
if called as
.Nm ,
2001-02-09 20:50:44 +03:00
provides compatibility for the options described below.
1993-03-21 12:45:37 +03:00
It does not provide compatibility for the
.Fl s
option (see
.Xr strings 1 )
or the
.Fl P ,
.Fl p ,
or
.Fl w
options, nor is compatibility provided for the ``label'' component
of the offset syntax.
2001-02-09 20:50:44 +03:00
.Pp
The options are as follows:
.Bl -tag -width Fl
.It Fl a
.Em One-byte character display .
Display the input offset in octal, followed by sixteen
space-separated, three column, space-filled, characters of input data
2002-09-30 15:08:56 +04:00
per line.
Control characters are printed as their names instead of as
2003-01-13 00:04:06 +03:00
C-style escapes.
2001-02-09 20:50:44 +03:00
.It Fl B
Same as
.Fl o .
.It Fl b
.Em One-byte octal display .
Display the input offset in octal, followed by sixteen
space-separated, three column, zero-filled, bytes of input data, in
2002-09-30 15:08:56 +04:00
octal, per line.
This is the default output style if no other is
2001-02-09 20:50:44 +03:00
selected.
.It Fl c
.Em One-byte character display .
Display the input offset in octal, followed by sixteen
space-separated, three column, space-filled, characters of input data
2002-09-30 15:08:56 +04:00
per line.
2003-01-13 00:04:06 +03:00
Control characters are printed at C-style escapes, or as
three octal digits, if no C escape exists for the character.
2001-02-09 20:50:44 +03:00
.It Fl d
.Em Two-byte decimal display .
Display the input offset in octal, followed by eight
space-separated, five column, zero-filled, two-byte units
of input data, in unsigned decimal, per line.
.It Fl e
.Em Eight-byte floating point display .
Display the input offset in octal, followed by two space-separated,
twenty-one column, space filled, eight byte units of input data, in
floating point, per line.
.It Fl F
Same as
.Fl e .
.It Fl f
.Em Four-byte floating point display .
Display the input offset in octal, followed by four space-separated,
14 column, space filled, four byte units of input data, in floating
point, per line.
.It Fl H
.Em Four-byte hex display .
Display the input offset in octal, followed by four space-separated,
eight column, zero filled, four byte units of input data, in hex,
per line.
.It Fl h
.Em Two-byte hex display .
Display the input offset in octal, followed by eight space-separated,
four column, zero filled, two byte units of input data, in hex,
per line.
.It Fl I
.Em Four-byte decimal display .
Display the input offset in octal, followed by four space-separated,
eleven column, space filled, four byte units of input data, in
decimal, per line.
.It Fl i
.Em Two-byte decimal display .
Display the input offset in octal, followed by eight space-separated,
six column, space filled, two-byte units of input data, in decimal,
per line.
.It Fl j Ar offset
Skip
.Ar offset
bytes from the beginning of the input.
By default,
.Ar offset
is interpreted as a decimal number.
With a leading
.Cm 0x
or
.Cm 0X ,
.Ar offset
is interpreted as a hexadecimal number,
otherwise, with a leading
.Cm 0 ,
.Ar offset
is interpreted as an octal number.
Appending the character
.Cm b ,
.Cm k ,
or
.Cm m
to
.Ar offset
causes it to be interpreted as a multiple of
.Li 512 ,
.Li 1024 ,
or
.Li 1048576 ,
respectively.
2001-02-09 20:50:44 +03:00
.It Fl L
Same as
.Fl I .
.It Fl l
Same as
.Fl I .
.It Fl N Ar length
Interpret only
.Ar length
bytes of input.
2001-02-09 20:50:44 +03:00
.It Fl O
.Em Four-byte octal display .
Display the input offset in octal, followed by four
space-separated, eleven column, zero-filled, four-byte units
of input data, in octal, per line.
.It Fl o
.Em Two-byte octal display .
Display the input offset in octal, followed by eight
space-separated, six column, zero-filled, two-byte units
of input data, in octal, per line.
.It Fl t Ar type_string
2002-09-30 15:08:56 +04:00
Specify one or more output types.
The
2001-02-09 20:50:44 +03:00
.Em type_string
option-argument must be a string specifying the types to be used when
2002-09-30 15:08:56 +04:00
writing the input data.
The string must consist of the type specification characters:
2001-02-09 20:50:44 +03:00
.Pp
.Cm a
selects US-ASCII output, with control characters replaced with their
2003-01-13 00:04:06 +03:00
names instead of as C escape sequences.
2002-09-30 15:08:56 +04:00
See also the
2001-02-09 20:50:44 +03:00
.Cm _u
conversion provided by hexdump(1).
.Pp
.Cm c
2002-09-30 15:08:56 +04:00
selects a standard character based conversion.
See also the
2001-02-09 20:50:44 +03:00
.Cm _c
conversion provided by hexdump(1).
.Pp
.Cm f
2002-09-30 15:08:56 +04:00
selects the floating point output format.
This type character can be optionally followed by the characters
2001-02-09 20:50:44 +03:00
.Cm 4
or
.Cm F
to specify four byte floating point output, or
.Cm 8
or
.Cm L
2002-09-30 15:08:56 +04:00
to specify eight byte floating point output.
The default output format is eight byte floats.
See also the
2001-02-09 20:50:44 +03:00
.Cm e
conversion provided by hexdump(1).
.Pp
.Cm d ,
.Cm o ,
.Cm u ,
or
.Cm x
select decimal, octal, unsigned decimal, or hex output respectively.
These types can optionally be followed by
.Cm C
to specify
.Em char Ns -sized
output,
2001-02-09 20:50:44 +03:00
.Cm S
to specify
.Em short Ns -sized
output,
2001-02-09 20:50:44 +03:00
.Cm I
to specify
.Em int Ns -sized
output,
2001-02-09 20:50:44 +03:00
.Cm L
to specify
.Em long Ns -sized
output,
.Cm 1
to specify one-byte output,
.Cm 2
to specify two-byte output,
.Cm 4
to specify four-byte output, or
2001-02-09 20:50:44 +03:00
.Cm 8
2002-09-30 15:08:56 +04:00
to specify eight-byte output.
The default output format is in four-byte quantities.
See also the
2001-02-09 20:50:44 +03:00
.Cm d ,
.Cm o ,
.Cm u ,
and
.Cm x
conversions provided by hexdump(1).
.\"(a|c|f[FLD]?|[doux][C1S2I4L8]?)*
.It Fl v
The
.Fl v
option causes
.Nm
to display all input data.
Without the
.Fl v
option, any number of groups of output lines, which would be
identical to the immediately preceding group of output lines (except
for the input offsets), are replaced with a line comprised of a
single asterisk.
.It Fl X
Same as
.Fl H .
.It Fl x
Same as
.Fl h .
.El
.Pp
For each input file,
.Nm
sequentially copies the input to standard output, transforming the
2002-09-30 15:08:56 +04:00
data according to the options given.
If no options are specified, the
2001-02-09 20:50:44 +03:00
default display is equivalent to specifying the
.Fl o
option.
.Pp
.Nm
exits 0 on success and \*[Gt]0 if an error occurred.
1993-03-21 12:45:37 +03:00
.Sh SEE ALSO
.Xr hexdump 1 ,
.Xr strings 1
2001-02-09 20:50:44 +03:00
.Sh HISTORY
A
.Nm
command appears in
.At v1 .
.Pp
This man page was written in February 2001 by Andrew Brown, shortly
2001-02-10 03:49:04 +03:00
after he augmented the deprecated od syntax to include things he felt
2001-10-04 00:29:39 +04:00
had been missing for a long time.