1.\" $OpenBSD: od.1,v 1.32 2020/01/16 16:46:47 schwarze Exp $ 2.\" $NetBSD: od.1,v 1.16 2001/12/07 01:23:42 bjh21 Exp $ 3.\" 4.\" Copyright (c) 2001 The NetBSD Foundation, Inc. 5.\" All rights reserved. 6.\" 7.\" This code is derived from software contributed to The NetBSD Foundation 8.\" by Andrew Brown. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29.\" POSSIBILITY OF SUCH DAMAGE. 30.\"/ 31.Dd $Mdocdate: January 16 2020 $ 32.Dt OD 1 33.Os 34.Sh NAME 35.Nm od 36.Nd octal, decimal, hex, ascii dump 37.Sh SYNOPSIS 38.Nm od 39.Op Fl aBbcDdeFfHhIiLlOosvXx 40.Op Fl A Ar base 41.Op Fl j Ar offset 42.Op Fl N Ar length 43.Op Fl t Ar type_string 44.Op Ar 45.Sh DESCRIPTION 46The 47.Nm 48utility is a filter which displays the specified files, or standard 49input if no files are specified, in a user specified format. 50.Pp 51The options are as follows: 52.Bl -tag -width Ds 53.It Fl A Ar base 54Specify the input address base. 55The argument 56.Ar base 57may be one of 58.Cm d , 59.Cm o , 60.Cm x , 61or 62.Cm n , 63which specify decimal, octal, hexadecimal 64addresses or no address, respectively. 65.It Fl a 66.Em One-byte character display . 67Display the input offset in octal, followed by sixteen 68space-separated, three column, space-filled, characters of input data 69per line. 70Control characters are printed as their names instead of as C-style escapes. 71.It Fl B 72Same as 73.Fl o . 74.It Fl b 75.Em One-byte octal display . 76Display the input offset in octal, followed by sixteen 77space-separated, three column, zero-filled, bytes of input data, in 78octal, per line. 79This is the default output style if no other is selected. 80.It Fl c 81.Em One-byte character display . 82Display the input offset in octal, followed by sixteen 83space-separated, three column, space-filled, characters of input data 84per line. 85Control characters are printed as c style escapes, or as three octal digits, 86if no c escape exists for the character. 87.It Fl D 88.Em Four-byte octal display . 89Display the input offset in octal, followed by four space-separated, 90ten column, space filled, four-byte units of input data, in octal, per line. 91.It Fl d 92.Em Two-byte unsigned decimal display . 93Display the input offset in octal, followed by eight 94space-separated, five column, zero-filled, two-byte units 95of input data, in unsigned decimal, per line. 96.It Fl e 97.Em Eight-byte floating point display . 98Display the input offset in octal, followed by two space-separated, 99twenty-one column, space filled, eight-byte units of input data, in 100floating point, per line. 101.It Fl F 102Same as 103.Fl e . 104.It Fl f 105.Em Four-byte floating point display . 106Display the input offset in octal, followed by four space-separated, 10714 column, space filled, four-byte units of input data, in floating 108point, per line. 109.It Fl H 110.Em Four-byte hex display . 111Display the input offset in octal, followed by four space-separated, 112eight column, zero filled, four-byte units of input data, in hex, 113per line. 114.It Fl h 115.Em Two-byte hex display . 116Display the input offset in octal, followed by eight space-separated, 117four column, zero filled, two-byte units of input data, in hex, 118per line. 119.It Fl I 120.Em Four-byte decimal display . 121Display the input offset in octal, followed by four space-separated, 122eleven column, space filled, four-byte units of input data, in 123decimal, per line. 124.It Fl i 125.Em Two-byte decimal display . 126Display the input offset in octal, followed by eight space-separated, 127six column, space filled, two-byte units of input data, in decimal, 128per line. 129.It Fl j Ar offset 130Skip 131.Ar offset 132bytes from the beginning of the input. 133By default, 134.Ar offset 135is interpreted as a decimal number. 136With a leading 137.Cm 0x 138or 139.Cm 0X , 140.Ar offset 141is interpreted as a hexadecimal number, 142otherwise, with a leading 143.Cm 0 , 144.Ar offset 145is interpreted as an octal number. 146Appending the character 147.Cm b , 148.Cm k , 149or 150.Cm m 151to 152.Ar offset 153causes it to be interpreted as a multiple of 154.Li 512 , 155.Li 1024 , 156or 157.Li 1048576 , 158respectively. 159.Pp 160As an alternative to 161.Nm 162.Fl j Ar offset 163.Op Ar file , 164the X/Open System Interfaces syntax 165.Nm 166.Op Ar file 167.Sm off 168.Op Cm \&+ 169.Ar offset 170.Op Cm \&. 171.Op Cm Bb 172.Sm on 173is also supported. 174.It Fl L 175Same as 176.Fl I . 177.It Fl l 178Same as 179.Fl I . 180.It Fl N Ar length 181Interpret only 182.Ar length 183bytes of input. 184.It Fl O 185.Em Four-byte octal display . 186Display the input offset in octal, followed by four 187space-separated, eleven column, zero-filled, four-byte units 188of input data, in octal, per line. 189.It Fl o 190.Em Two-byte octal display . 191Display the input offset in octal, followed by eight 192space-separated, six column, zero-filled, two-byte units 193of input data, in octal, per line. 194.It Fl s 195.Em Two-byte signed decimal display . 196Display the input offset in octal, followed by eight 197space-separated, five column, zero-filled, two-byte units 198of input data, in signed decimal, per line. 199.It Fl t Ar type_string 200Specify one or more output types. 201The 202.Em type_string 203option-argument must be a string specifying the types to be used when 204writing the input data. 205The string must consist of the type specification characters: 206.Pp 207.Cm a 208selects US-ASCII output, with control characters replaced with their 209names instead of as c escape sequences. 210See also the 211.Cm _u 212conversion provided by 213.Xr hexdump 1 . 214.Pp 215.Cm c 216selects a standard character based conversion. 217See also the 218.Cm _c 219conversion provided by 220.Xr hexdump 1 . 221.Pp 222.Cm f 223selects the floating point output format. 224This type character can be optionally followed by the characters 225.Cm 4 226or 227.Cm F 228to specify four-byte floating point output, or 229.Cm 8 230or 231.Cm L 232to specify eight-byte floating point output. 233The default output format is eight-byte floats. 234See also the 235.Cm e 236conversion provided by 237.Xr hexdump 1 . 238.Pp 239.Cm d , 240.Cm o , 241.Cm u , 242or 243.Cm x 244select decimal, octal, unsigned decimal, or hex output respectively. 245These types can optionally be followed by 246.Cm C 247to specify 248.Em char Ns -sized 249output, 250.Cm S 251to specify 252.Em short Ns -sized 253output, 254.Cm I 255to specify 256.Em int Ns -sized 257output, 258.Cm L 259to specify 260.Em long Ns -sized 261output, 262.Cm 1 263to specify one-byte output, 264.Cm 2 265to specify two-byte output, 266.Cm 4 267to specify four-byte output, or 268.Cm 8 269to specify eight-byte output. 270The default output format is in four-byte quantities. 271See also the 272.Cm d , 273.Cm o , 274.Cm u , 275and 276.Cm x 277conversions provided by 278.Xr hexdump 1 . 279.\"(a|c|f[FLD]?|[doux][C1S2I4L8]?)* 280.It Fl v 281The 282.Fl v 283option causes 284.Nm 285to display all input data. 286Without the 287.Fl v 288option, any number of groups of output lines, which would be 289identical to the immediately preceding group of output lines (except 290for the input offsets), are replaced with a line comprised of a 291single asterisk. 292.It Fl X 293Same as 294.Fl H . 295.It Fl x 296Same as 297.Fl h . 298.El 299.Pp 300For each input file, 301.Nm 302sequentially copies the input to standard output, transforming the 303data according to the options given. 304If no options are specified, the default display is equivalent to 305specifying the 306.Fl o 307option. 308.Sh EXIT STATUS 309.Ex -std od 310.Sh SEE ALSO 311.Xr hexdump 1 312.Sh STANDARDS 313The 314.Nm 315utility is compliant with the 316.St -p1003.1-2008 317specification. 318.Pp 319The flags 320.Op Fl bcdosx 321as well as the 322.Ar offset 323specifier are marked by 324.St -p1003.1-2008 325as being an 326X/Open System Interfaces 327option. 328.Pp 329The flags 330.Op Fl aBDeFfHhIiLlOX 331are extensions to that specification. 332.Sh HISTORY 333An 334.Nm 335command appears in 336.At v1 . 337.Pp 338This man page was written in February 2001 by Andrew Brown, shortly 339after he augmented the 340.Nm 341syntax to include things he felt had been missing for a long time. 342