Merge commit 'b31320a79e2054c6739b5229259dbf98f3afc547' into merges
[unleashed.git] / share / man / man1 / od.1
blobeb6f40c23e704bec2eb33c650a0b911252d82c47
1 '\" te
2 .\"  Copyright 1989 AT&T  Copyright (c) 1992, X/Open Company Limited  All Rights Reserved  Portions Copyright (c) 2005, Sun Microsystems, Inc.  All Rights Reserved
3 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
4 .\" http://www.opengroup.org/bookstore/.
5 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
6 .\"  This notice shall appear on any product containing this material.
7 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
9 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
10 .TH OD 1 "Oct 25, 2017"
11 .SH NAME
12 od \- octal dump
13 .SH SYNOPSIS
14 .LP
15 .nf
16 \fB/usr/bin/od\fR [\fB-bcCDdFfOoSsvXx\fR] [\fIfile\fR] [\fIoffset_string\fR]
17 .fi
19 .LP
20 .nf
21 \fB/usr/bin/od\fR [\fB-bcCDdFfOoSsvXx\fR] [\fB-A\fR \fIaddress_base\fR]
22      [\fB-j\fR \fIskip\fR] [\fB-N\fR \fIcount\fR] [\fB-t\fR \fItype_string\fR]... [\fIfile\fR]...
23 .fi
25 .SH DESCRIPTION
26 .sp
27 .LP
28 The \fBod\fR command copies sequentially each input file to standard output and
29 transforms the input data according to the output types specified by the
30 \fB-t\fR or \fB-bcCDdFfOoSsvXx\fR options. If no output type is specified, the
31 default output is as if \fB-t\fR \fBo2\fR had been specified.  Multiple types
32 can be specified by using multiple \fB-bcCDdFfOoSstvXx\fR options. Output lines
33 are written for each type specified in the order in which the types are
34 specified.  If no \fIfile\fR is specified, the standard input is used.  The
35 [\fIoffset_string\fR] operand is mutually exclusive from the \fB-A\fR,
36 \fB-j\fR, \fB-N\fR, and \fB-t\fR options. For the purposes of this description,
37 the following terms are used:
38 .sp
39 .ne 2
40 .na
41 \fBword\fR
42 .ad
43 .RS 20n
44 Refers to a 16-bit unit, independent of the word size of the machine.
45 .RE
47 .sp
48 .ne 2
49 .na
50 \fBlong word\fR
51 .ad
52 .RS 20n
53 Refers to a 32-bit unit.
54 .RE
56 .sp
57 .ne 2
58 .na
59 \fBdouble long word\fR
60 .ad
61 .RS 20n
62 Refers to a 64-bit unit.
63 .RE
65 .SH OPTIONS
66 .sp
67 .LP
68 The following options are supported:
69 .sp
70 .ne 2
71 .na
72 \fB\fB-A\fR \fIaddress_base\fR \fR
73 .ad
74 .RS 20n
75 Specifies the input offset base. The \fIaddress_base\fR option-argument must be
76 a character.  The characters \fBd\fR, \fBo\fR and \fBx\fR specify that the
77 offset base will be written in decimal, octal or hexadecimal, respectively. The
78 character \fBn\fR specifies that the offset will not be written. Unless
79 \fB-A\fR \fBn\fR is specified, the output line will be preceded by the input
80 offset, cumulative across input files, of the next byte to be written. In
81 addition, the offset of the byte following the last byte written will be
82 displayed after all the input data has been processed. Without the \fB-A\fR
83 \fIaddress_base\fR option and the [\fIoffset_string\fR] operand, the input
84 offset base is displayed in octal.
85 .RE
87 .sp
88 .ne 2
89 .na
90 \fB\fB-b\fR \fR
91 .ad
92 .RS 20n
93 Interprets bytes in octal.  This is equivalent to \fB-t\fR \fBo1\fR.
94 .RE
96 .sp
97 .ne 2
98 .na
99 \fB\fB-c\fR \fR
101 .RS 19n
102 Interprets bytes as single-byte or multibyte characters according to the
103 current setting of the \fBLC_CTYPE\fR locale category. Printable multibyte
104 characters are written in the area corresponding to the first byte of the
105 character. The two-character sequence \fB**\fR is written in the area
106 corresponding to each remaining byte in the character, as an indication that
107 the character is continued. Non-graphic characters appear the same as they
108 would using the \fB-C\fR option.
112 .ne 2
114 \fB\fB-C\fR \fR
116 .RS 19n
117 Interprets bytes as single-byte or multibyte characters according to the
118 current setting of the \fBLC_CTYPE\fR locale category. Printable multibyte
119 characters are written in the area corresponding to the first byte of the
120 character. The two-character sequence ** is written in the area corresponding
121 to each remaining byte in the character, as an indication that the character is
122 continued. Certain non-graphic characters appear as C escapes:
124 .in +2
126 null            \fB\e0\fR
127 backspace          \fB\eb\fR
128 form-feed          \fB\ef\fR
129 new-line           \fB\en\fR
130 return     \fB\er\fR
131 tab             \fB\et\fR
133 .in -2
136 Other non-printable characters appear as one three-digit octal number for each
137 byte in the character.
141 .ne 2
143 \fB\fB-d\fR \fR
145 .RS 19n
146 Interprets words in unsigned decimal.  This is equivalent to \fB-t\fR \fBu2\fR.
150 .ne 2
152 \fB\fB-D\fR \fR
154 .RS 19n
155 Interprets long words in unsigned decimal. This is equivalent to \fB-t\fR
156 \fBu4\fR.
160 .ne 2
162 \fB\fB-f\fR \fR
164 .RS 19n
165 Interprets long words in floating point.  This is equivalent to \fB-t\fR
166 \fBf4\fR.
170 .ne 2
172 \fB\fB-F\fR \fR
174 .RS 19n
175 Interprets double long words in extended precision. This is equivalent to
176 \fB-t\fR \fBf8\fR.
180 .ne 2
182 \fB\fB-j\fR \fIskip\fR \fR
184 .RS 19n
185 Jumps over \fIskip\fR bytes from the beginning of the input. The \fBod\fR
186 command will read or seek past the first \fIskip\fR bytes in the concatenated
187 input files.  If the combined input is not at least \fIskip\fR bytes long, the
188 \fBod\fR command will write a diagnostic message to standard error and exit
189 with a non-zero exit status.
191 By default, the \fIskip\fR option-argument is interpreted as a decimal number.
192 With a leading \fB0x\fR or \fB0X\fR, the offset is interpreted as a hexadecimal
193 number; otherwise, with a leading \fB0\fR, the offset will be interpreted as an
194 octal number.  Appending the character \fBb\fR, \fBk\fR, or \fBm\fR to offset
195 will cause it to be interpreted as a multiple of \fB512\fR, \fB1024\fR or
196 \fB1\|048\|576\fR bytes, respectively. If the \fIskip\fR number is hexadecimal,
197 any appended \fBb\fR is considered to be the final hexadecimal digit. The
198 address is displayed starting at \fB0000000\fR, and its base is not implied by
199 the base of the \fIskip\fR option-argument.
203 .ne 2
205 \fB\fB-N\fR \fIcount\fR \fR
207 .RS 19n
208 Formats no more than \fIcount\fR bytes of input. By default, \fIcount\fR is
209 interpreted as a decimal number.  With a leading \fB0x\fR or \fB0X\fR,
210 \fIcount\fR is interpreted as a hexadecimal number; otherwise, with a leading
211 \fB0\fR, it is interpreted as an octal number. If \fIcount\fR bytes of input
212 (after successfully skipping, if \fB-j\fR\fIskip\fR is specified) are not
213 available, it will not be considered an error. The \fBod\fR command will format
214 the input that is available.  The base of the address displayed is not implied
215 by the base of the \fIcount\fR option-argument.
219 .ne 2
221 \fB\fB-o\fR \fR
223 .RS 19n
224 Interprets words in octal. This is equivalent to \fB-t\fR \fBo2\fR.
228 .ne 2
230 \fB\fB-O\fR \fR
232 .RS 19n
233 Interprets long words in unsigned octal.  This is equivalent to \fB-t\fR
234 \fBo4\fR.
238 .ne 2
240 \fB\fB-s\fR \fR
242 .RS 19n
243 Interprets words in signed decimal. This is equivalent to \fB-t\fR \fBd2\fR.
247 .ne 2
249 \fB\fB-S\fR \fR
251 .RS 19n
252 Interprets long words in signed decimal. This is equivalent to \fB-t\fR
253 \fBd4\fR.
257 .ne 2
259 \fB\fB-t\fR \fItype_string\fR \fR
261 .RS 19n
262 Specifies one or more output types. The \fItype_string\fR option-argument must
263 be a string specifying the types to be used when writing the input data. The
264 string must consist of the type specification characters:
266 .ne 2
268 \fB\fBa\fR \fR
270 .RS 6n
271 \fINamed character\fR. Interprets bytes as named characters. Only the least
272 significant seven bits of each byte will be used for this type specification.
273 Bytes with the values listed in the following table will be written using the
274 corresponding names for those characters.
276 The following are named characters in \fBod\fR:
278 .in +2
280 Value   Name
282 \000    nul
283 \001    soh
284 \002    stx
285 \003    etx
286 \004    eot
287 \005    enq
288 \006    ack
289 \007    bel
290 \010    bs
291 \011    ht
292 \012    lf
293 \013    vt
294 \014    ff
295 \015    cr
296 \016    so
297 \017    si
298 \020    dle
299 \021    dc1
300 \022    dc2
301 \023    dc3
302 \024    dc4
303 \025    nak
304 \026    syn
305 \027    etb
306 \030    can
307 \031    em
308 \032    sub
309 \033    esc
310 \034    fs
311 \035    gs
312 \036    rs
313 \037    us
314 \040    sp
315 \177    del
317 .in -2
323 .ne 2
325 \fB\fBc\fR \fR
327 .RS 6n
328 \fICharacter\fR. Interprets bytes as single-byte or multibyte characters
329 specified by the current setting of the \fBLC_CTYPE\fR locale category.
330 Printable multibyte characters are written in the area corresponding to the
331 first byte of the character. The two-character sequence \fB**\fR is written in
332 the area corresponding to each remaining byte in the character, as an
333 indication that the character is continued. Certain non-graphic characters
334 appear as C escapes: \fB\e0\fR, \fB\ea\fR, \fB\eb\fR, \fB\ef\fR, \fB\en\fR,
335 \fB\er\fR, \fB\et\fR, \fB\ev\fR\&. Other non-printable characters appear as one
336 three-digit octal number for each byte in the character.
339 The type specification characters \fBd\fR, \fBf\fR, \fBo\fR, \fBu\fR, and
340 \fBx\fR can be followed by an optional unsigned decimal integer that specifies
341 the number of bytes to be transformed by each instance of the output type.
343 .ne 2
345 \fB\fBf\fR \fR
347 .RS 18n
348 \fIFloating point\fR. Can be followed by an optional \fBF\fR, \fBD\fR, or
349 \fBL\fR indicating that the conversion should be applied to an item of type
350 \fBfloat\fR, \fBdouble\fR, or \fBlong double\fR, respectively.
354 .ne 2
356 \fB\fBd\fR, \fBo\fR, \fBu\fR, and \fBx\fR\fR
358 .RS 18n
359 \fISigned decimal\fR, \fIoctal\fR, \fIunsigned decimal\fR, and
360 \fIhexadecimal\fR, respectively. Can be followed by an optional \fBC\fR,
361 \fBS\fR, \fBI\fR, or \fBL\fR indicating that the conversion should be applied
362 to an item of type \fBchar\fR, \fBshort\fR, \fBint\fR, or \fBlong\fR,
363 respectively.
366 Multiple types can be concatenated within the same \fItype_string\fR and
367 multiple \fB-t\fR options can be specified. Output lines are written for each
368 type specified in the order in which the type specification characters are
369 specified.
373 .ne 2
375 \fB\fB-v\fR \fR
377 .RS 19n
378 Shows all input data (verbose). Without the \fB-v\fR option, all groups of
379 output lines that would be identical to the immediately preceding output line
380 (except for byte offsets), will be replaced with a line containing only an
381 asterisk (*).
385 .ne 2
387 \fB\fB-x\fR \fR
389 .RS 19n
390 Interprets words in hex. This is equivalent to \fB-t\fR \fBx2\fR.
394 .ne 2
396 \fB\fB-X\fR \fR
398 .RS 19n
399 Interprets long words in hex. This is equivalent to \fB-t\fR \fBx4\fR.
402 .SH OPERANDS
405 The following operands are supported:
407 .ne 2
409 \fB\fIfile\fR \fR
411 .RS 26n
412 A path name of a file to be read. If no \fIfile\fR operands are specified, the
413 standard input will be used. If there are no more than two operands, none of
414 the \fB-A\fR, \fB-j\fR, \fB-N\fR, or \fB-t\fR options is specified, and
415 \fIany\fR of the following are true:
416 .RS +4
419 the first character of the last operand is a plus sign (+)
421 .RS +4
424 the first character of the second operand is numeric
426 .RS +4
429 the first character of the second operand is \fBx\fR and the second
430 character of the second operand is a lower-case hexadecimal character or digit
432 .RS +4
435 the second operand is named "\fBx\fR"
437 .RS +4
440 the second operand is named "\fB\&.\fR"
442 then the corresponding operand is assumed to be an offset operand rather than a
443 file operand.
445 Without the \fB-N\fR count option, the display continues until an end-of-file
446 is reached.
447 Only one of the first two conditions must be true.
451 .ne 2
453 \fB\fB[+] [0] \fR\fIoffset\fR \fB[.]\|[b|B]\fR\fR
457 \fB\fB+ [\fR\fIoffset\fR] \fB[.]\fR\fR
461 \fB\fB[+][0x]\fR[\fIoffset\fR]\fR
465 \fB\fB[+][0x]\fR \fIoffset\fR\fB\|[B]\fR\fR
469 \fB\fB+x [\fR\fIoffset\fR\fB]\fR\fR
473 \fB\fB+x\fR\fIoffset \fR\fB[B]\fR\fR
476 .RS 26n
477 The \fIoffset_string\fR operand specifies the byte offset in the file where
478 dumping is to commence.  The offset is interpreted in octal bytes by default.
479 If \fIoffset\fR begins with "\fB0\fR", it is interpreted in octal. If
480 \fIoffset\fR begins with "\fBx\fR" or "\fB0x\fR", it is interpreted in
481 hexadecimal and any appended "\fBb\fR" is considered to be the final
482 hexadecimal digit. If "." is appended, the offset is interpreted in decimal. If
483 "\fBb\fR" or "\fBB\fR" is appended, the offset is interpreted in units of
484 \fB512\fR bytes. If the \fBfile\fR argument is omitted, the \fIoffset\fR
485 argument must be preceded by a plus sign (\fB+\fR).  The address is displayed
486 starting at the given offset.  The radix of the address will be the same as the
487 radix of the offset, if specified, otherwise it will be octal.  Decimal
488 overrides octal, and it is an error to specify both hexadecimal and decimal
489 conversions in the same offset operand.
492 .SH ENVIRONMENT VARIABLES
495 See \fBenviron\fR(5) for descriptions of the following environment variables
496 that affect the execution of \fBod\fR: \fBLANG\fR, \fBLC_ALL\fR,
497 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, \fBLC_NUMERIC\fR, and \fBNLSPATH\fR.
498 .SH EXIT STATUS
501 The following exit values are returned:
503 .ne 2
505 \fB\fB0\fR \fR
507 .RS 7n
508 Successful completion.
512 .ne 2
514 \fB\fB>0\fR \fR
516 .RS 7n
517 An error occurred.
520 .SH ATTRIBUTES
523 See \fBattributes\fR(5) for descriptions of the following attributes:
524 .SS "/usr/bin/od"
529 box;
530 c | c
531 l | l .
532 ATTRIBUTE TYPE  ATTRIBUTE VALUE
534 CSI     enabled
536 Interface Stability     Standard
539 .SH SEE ALSO
542 \fBsed\fR(1), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)