9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man1 / od.1
blob222f2c200cf4feb5c5efe9323b64dc2f998fc66e
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
45 .\" Portions Copyright (c) 2005, Sun Microsystems, Inc.  All Rights Reserved.
46 .\"
47 .TH OD 1 "May 20, 2005"
48 .SH NAME
49 od \- octal dump
50 .SH SYNOPSIS
51 .LP
52 .nf
53 \fB/usr/bin/od\fR [\fB-bcCDdFfOoSsvXx\fR] [\fB-\fR] [\fIfile\fR] [\fIoffset_string\fR]
54 .fi
56 .LP
57 .nf
58 \fB/usr/bin/od\fR [\fB-bcCDdFfOoSsvXx\fR] [\fB-A\fR \fIaddress_base\fR] [\fB-j\fR \fIskip\fR]
59      [\fB-N\fR \fIcount\fR] [\fB-t\fR \fItype_string\fR]... [\fB-\fR] [\fIfile\fR]...
60 .fi
62 .LP
63 .nf
64 \fB/usr/xpg4/bin/od\fR [\fB-bcCDdFfOoSsvXx\fR] [\fIfile\fR] [\fIoffset_string\fR]
65 .fi
67 .LP
68 .nf
69 \fB/usr/xpg4/bin/od\fR [\fB-bcCDdFfOoSsvXx\fR] [\fB-A\fR \fIaddress_base\fR]
70      [\fB-j\fR \fIskip\fR] [\fB-N\fR \fIcount\fR] [\fB-t\fR \fItype_string\fR]... [\fIfile\fR]...
71 .fi
73 .SH DESCRIPTION
74 .sp
75 .LP
76 The \fBod\fR command copies sequentially each input file to standard output and
77 transforms the input data according to the output types specified by the
78 \fB-t\fR or \fB-bcCDdFfOoSsvXx\fR options. If no output type is specified, the
79 default output is as if \fB-t\fR \fBo2\fR had been specified.  Multiple types
80 can be specified by using multiple \fB-bcCDdFfOoSstvXx\fR options. Output lines
81 are written for each type specified in the order in which the types are
82 specified.  If no \fIfile\fR is specified, the standard input is used.  The
83 [\fIoffset_string\fR] operand is mutually exclusive from the \fB-A\fR,
84 \fB-j\fR, \fB-N\fR, and \fB-t\fR options. For the purposes of this description,
85 the following terms are used:
86 .sp
87 .ne 2
88 .na
89 \fBword\fR
90 .ad
91 .RS 20n
92 Refers to a 16-bit unit, independent of the word size of the machine.
93 .RE
95 .sp
96 .ne 2
97 .na
98 \fBlong word\fR
99 .ad
100 .RS 20n
101 Refers to a 32-bit unit.
105 .ne 2
107 \fBdouble long word\fR
109 .RS 20n
110 Refers to a 64-bit unit.
113 .SH OPTIONS
116 The following options are supported:
118 .ne 2
120 \fB\fB-A\fR \fIaddress_base\fR \fR
122 .RS 20n
123 Specifies the input offset base. The \fIaddress_base\fR option-argument must be
124 a character.  The characters \fBd\fR, \fBo\fR and \fBx\fR specify that the
125 offset base will be written in decimal, octal or hexadecimal, respectively. The
126 character \fBn\fR specifies that the offset will not be written. Unless
127 \fB-A\fR \fBn\fR is specified, the output line will be preceded by the input
128 offset, cumulative across input files, of the next byte to be written. In
129 addition, the offset of the byte following the last byte written will be
130 displayed after all the input data has been processed. Without the \fB-A\fR
131 \fIaddress_base\fR option and the [\fIoffset_string\fR] operand, the input
132 offset base is displayed in octal.
136 .ne 2
138 \fB\fB-b\fR \fR
140 .RS 20n
141 Interprets bytes in octal.  This is equivalent to \fB-t\fR \fBo1\fR.
144 .SS "/usr/bin/od"
146 .ne 2
148 \fB\fB-c\fR \fR
150 .RS 7n
151 Displays single-byte characters. Certain non-graphic characters appear as
152 C-language escapes:
154 .in +2
156 null            \fB\e0\fR
157 backspace          \fB\eb\fR
158 form-feed          \fB\ef\fR
159 new-line           \fB\en\fR
160 return     \fB\er\fR
161 tab             \fB\et\fR
163 .in -2
166 Others appear as 3-digit octal numbers. For example:
168 .in +2
170 \fBecho "hello world" | od \(mic\fR
171 0000000   h   e   l   l   o       w   o   r   l   d  \en
172 0000014
174 .in -2
179 .SS "/usr/xpg4/bin/od"
181 .ne 2
183 \fB\fB-c\fR \fR
185 .RS 19n
186 Interprets bytes as single-byte or multibyte characters according to the
187 current setting of the \fBLC_CTYPE\fR locale category. Printable multibyte
188 characters are written in the area corresponding to the first byte of the
189 character. The two-character sequence \fB**\fR is written in the area
190 corresponding to each remaining byte in the character, as an indication that
191 the character is continued. Non-graphic characters appear the same as they
192 would using the \fB-C\fR option.
196 .ne 2
198 \fB\fB-C\fR \fR
200 .RS 19n
201 Interprets bytes as single-byte or multibyte characters according to the
202 current setting of the \fBLC_CTYPE\fR locale category. Printable multibyte
203 characters are written in the area corresponding to the first byte of the
204 character. The two-character sequence ** is written in the area corresponding
205 to each remaining byte in the character, as an indication that the character is
206 continued. Certain non-graphic characters appear as C escapes:
208 .in +2
210 null            \fB\e0\fR
211 backspace          \fB\eb\fR
212 form-feed          \fB\ef\fR
213 new-line           \fB\en\fR
214 return     \fB\er\fR
215 tab             \fB\et\fR
217 .in -2
220 Other non-printable characters appear as one three-digit octal number for each
221 byte in the character.
225 .ne 2
227 \fB\fB-d\fR \fR
229 .RS 19n
230 Interprets words in unsigned decimal.  This is equivalent to \fB-t\fR \fBu2\fR.
234 .ne 2
236 \fB\fB-D\fR \fR
238 .RS 19n
239 Interprets long words in unsigned decimal. This is equivalent to \fB-t\fR
240 \fBu4\fR.
244 .ne 2
246 \fB\fB-f\fR \fR
248 .RS 19n
249 Interprets long words in floating point.  This is equivalent to \fB-t\fR
250 \fBf4\fR.
254 .ne 2
256 \fB\fB-F\fR \fR
258 .RS 19n
259 Interprets double long words in extended precision. This is equivalent to
260 \fB-t\fR \fBf8\fR.
264 .ne 2
266 \fB\fB-j\fR \fIskip\fR \fR
268 .RS 19n
269 Jumps over \fIskip\fR bytes from the beginning of the input. The \fBod\fR
270 command will read or seek past the first \fIskip\fR bytes in the concatenated
271 input files.  If the combined input is not at least \fIskip\fR bytes long, the
272 \fBod\fR command will write a diagnostic message to standard error and exit
273 with a non-zero exit status.
275 By default, the \fIskip\fR option-argument is interpreted as a decimal number.
276 With a leading \fB0x\fR or \fB0X\fR, the offset is interpreted as a hexadecimal
277 number; otherwise, with a leading \fB0\fR, the offset will be interpreted as an
278 octal number.  Appending the character \fBb\fR, \fBk\fR, or \fBm\fR to offset
279 will cause it to be interpreted as a multiple of \fB512\fR, \fB1024\fR or
280 \fB1\|048\|576\fR bytes, respectively. If the \fIskip\fR number is hexadecimal,
281 any appended \fBb\fR is considered to be the final hexadecimal digit. The
282 address is displayed starting at \fB0000000\fR, and its base is not implied by
283 the base of the \fIskip\fR option-argument.
287 .ne 2
289 \fB\fB-N\fR \fIcount\fR \fR
291 .RS 19n
292 Formats no more than \fIcount\fR bytes of input. By default, \fIcount\fR is
293 interpreted as a decimal number.  With a leading \fB0x\fR or \fB0X\fR,
294 \fIcount\fR is interpreted as a hexadecimal number; otherwise, with a leading
295 \fB0\fR, it is interpreted as an octal number. If \fIcount\fR bytes of input
296 (after successfully skipping, if \fB-j\fR\fIskip\fR is specified) are not
297 available, it will not be considered an error. The \fBod\fR command will format
298 the input that is available.  The base of the address displayed is not implied
299 by the base of the \fIcount\fR option-argument.
303 .ne 2
305 \fB\fB-o\fR \fR
307 .RS 19n
308 Interprets words in octal. This is equivalent to \fB-t\fR \fBo2\fR.
312 .ne 2
314 \fB\fB-O\fR \fR
316 .RS 19n
317 Interprets long words in unsigned octal.  This is equivalent to \fB-t\fR
318 \fBo4\fR.
322 .ne 2
324 \fB\fB-s\fR \fR
326 .RS 19n
327 Interprets words in signed decimal. This is equivalent to \fB-t\fR \fBd2\fR.
331 .ne 2
333 \fB\fB-S\fR \fR
335 .RS 19n
336 Interprets long words in signed decimal. This is equivalent to \fB-t\fR
337 \fBd4\fR.
341 .ne 2
343 \fB\fB-t\fR \fItype_string\fR \fR
345 .RS 19n
346 Specifies one or more output types. The \fItype_string\fR option-argument must
347 be a string specifying the types to be used when writing the input data. The
348 string must consist of the type specification characters:
350 .ne 2
352 \fB\fBa\fR \fR
354 .RS 6n
355 \fINamed character\fR. Interprets bytes as named characters. Only the least
356 significant seven bits of each byte will be used for this type specification.
357 Bytes with the values listed in the following table will be written using the
358 corresponding names for those characters.
360 The following are named characters in \fBod\fR:
362 .in +2
364 Value   Name
366 \e000    nul
367 \e001    soh
368 \e002    stx
369 \e003    etx
370 \e004    eot
371 \e005    enq
372 \e006    ack
373 \e007    bel
374 \e010    bs
375 \e011    ht
376 \e012    lf
377 \e013    vt
378 \e014    ff
379 \e015    cr
380 \e016    so
381 \e017    si
382 \e020    dle
383 \e021    dc1
384 \e022    dc2
385 \e023    dc3
386 \e024    dc4
387 \e025    nak
388 \e026    syn
389 \e027    etb
390 \e030    can
391 \e031    em
392 \e032    sub
393 \e033    esc
394 \e034    fs
395 \e035    gs
396 \e036    rs
397 \e037    us
398 \e040    sp
399 \e177    del
401 .in -2
407 .ne 2
409 \fB\fBc\fR \fR
411 .RS 6n
412 \fICharacter\fR. Interprets bytes as single-byte or multibyte characters
413 specified by the current setting of the \fBLC_CTYPE\fR locale category.
414 Printable multibyte characters are written in the area corresponding to the
415 first byte of the character. The two-character sequence \fB**\fR is written in
416 the area corresponding to each remaining byte in the character, as an
417 indication that the character is continued. Certain non-graphic characters
418 appear as C escapes: \fB\e0\fR, \fB\ea\fR, \fB\eb\fR, \fB\ef\fR, \fB\en\fR,
419 \fB\er\fR, \fB\et\fR, \fB\ev\fR\&. Other non-printable characters appear as one
420 three-digit octal number for each byte in the character.
423 The type specification characters \fBd\fR, \fBf\fR, \fBo\fR, \fBu\fR, and
424 \fBx\fR can be followed by an optional unsigned decimal integer that specifies
425 the number of bytes to be transformed by each instance of the output type.
427 .ne 2
429 \fB\fBf\fR \fR
431 .RS 18n
432 \fIFloating point\fR. Can be followed by an optional \fBF\fR, \fBD\fR, or
433 \fBL\fR indicating that the conversion should be applied to an item of type
434 \fBfloat\fR, \fBdouble\fR, or \fBlong double\fR, respectively.
438 .ne 2
440 \fB\fBd\fR, \fBo\fR, \fBu\fR, and \fBx\fR\fR
442 .RS 18n
443 \fISigned decimal\fR, \fIoctal\fR, \fIunsigned decimal\fR, and
444 \fIhexadecimal\fR, respectively. Can be followed by an optional \fBC\fR,
445 \fBS\fR, \fBI\fR, or \fBL\fR indicating that the conversion should be applied
446 to an item of type \fBchar\fR, \fBshort\fR, \fBint\fR, or \fBlong\fR,
447 respectively.
450 Multiple types can be concatenated within the same \fItype_string\fR and
451 multiple \fB-t\fR options can be specified. Output lines are written for each
452 type specified in the order in which the type specification characters are
453 specified.
457 .ne 2
459 \fB\fB-v\fR \fR
461 .RS 19n
462 Shows all input data (verbose). Without the \fB-v\fR option, all groups of
463 output lines that would be identical to the immediately preceding output line
464 (except for byte offsets), will be replaced with a line containing only an
465 asterisk (*).
469 .ne 2
471 \fB\fB-x\fR \fR
473 .RS 19n
474 Interprets words in hex. This is equivalent to \fB-t\fR \fBx2\fR.
478 .ne 2
480 \fB\fB-X\fR \fR
482 .RS 19n
483 Interprets long words in hex. This is equivalent to \fB-t\fR \fBx4\fR.
486 .SH OPERANDS
487 .SS "/usr/bin/od"
490 The following operands are supported for \fB/usr/bin/od\fR only:
492 .ne 2
494 \fB\fB\(mi\fR \fR
496 .RS 26n
497 Uses the standard input in addition to any files specified.  When this operand
498 is not given, the standard input is used only if no \fIfile\fR operands are
499 specified.
503 .ne 2
505 \fB\fIfile\fR \fR
507 .RS 26n
508 A path name of a file to be read. If no \fIfile\fR operands are specified, the
509 standard input will be used. If there are no more than two operands, none of
510 the \fB-A\fR, \fB-j\fR, \fB-N\fR, or \fB-t\fR options is specified, and
511 \fIany\fR of the following are true:
512 .RS +4
515 the first character of the last operand is a plus sign (+)
517 .RS +4
520 the first character of the second operand is numeric
522 .RS +4
525 the first character of the second operand is \fBx\fR and the second
526 character of the second operand is a lower-case hexadecimal character or digit
528 .RS +4
531 the second operand is named "\fBx\fR"
533 .RS +4
536 the second operand is named "\fB\&.\fR"
538 then the corresponding operand is assumed to be an offset operand rather than a
539 file operand.
541 Without the \fB-N\fR count option, the display continues until an end-of-file
542 is reached.
546 .ne 2
548 \fB\fB[+][0]\fR \fIoffset\fR \fB[.][b|B]\fR\fR
552 \fB\fB[+][0][\fR\fIoffset\fR] \fB[.]\fR\fR
556 \fB\fB[+][0x|x]\fR[\fIoffset\fR]\fR
560 \fB\fB[+][0x|x]\fR \fIoffset\fR\fB[B]\fR\fR
562 .RS 26n
563 The \fIoffset_string\fR operand specifies the byte offset in the file where
564 dumping is to commence.  The offset is interpreted in octal bytes by default.
565 If \fIoffset\fR begins with "\fB0\fR", it is interpreted in octal. If
566 \fIoffset\fR begins with "\fBx\fR" or "\fB0x\fR", it is interpreted in
567 hexadecimal and any appended "\fBb\fR" is considered to be the final
568 hexadecimal digit. If "." is appended, the offset is interpreted in decimal. If
569 "\fBb\fR" or "\fBB\fR" is appended, the offset is interpreted in units of
570 \fB512\fR bytes. If the \fBfile\fR argument is omitted, the \fIoffset\fR
571 argument must be preceded by a plus sign (\fB+\fR).  The address is displayed
572 starting at the given offset.  The radix of the address will be the same as the
573 radix of the offset, if specified, otherwise it will be octal.  Decimal
574 overrides octal, and it is an error to specify both hexadecimal and decimal
575 conversions in the same offset operand.
578 .SS "/usr/xpg4/bin/od"
581 The following operands are supported for \fB/usr/xpg4/bin/od\fR only:
583 .ne 2
585 \fB\fIfile\fR \fR
587 .RS 29n
588 Same as \fB/usr/bin/od\fR, except only one of the first two conditions must be
589 true.
593 .ne 2
595 \fB\fB[+] [0] \fR\fIoffset\fR \fB[.]\|[b|B]\fR\fR
599 \fB\fB+ [\fR\fIoffset\fR] \fB[.]\fR\fR
603 \fB\fB[+][0x]\fR[\fIoffset\fR]\fR
607 \fB\fB[+][0x]\fR \fIoffset\fR\fB\|[B]\fR\fR
611 \fB\fB+x [\fR\fIoffset\fR\fB]\fR\fR
615 \fB\fB+x\fR\fIoffset \fR\fB[B]\fR\fR
617 .RS 29n
618 Description of \fIoffset_string\fR is the same as for \fB/usr/bin/od\fR.
621 .SH ENVIRONMENT VARIABLES
624 See \fBenviron\fR(5) for descriptions of the following environment variables
625 that affect the execution of \fBod\fR: \fBLANG\fR, \fBLC_ALL\fR,
626 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, \fBLC_NUMERIC\fR, and \fBNLSPATH\fR.
627 .SH EXIT STATUS
630 The following exit values are returned:
632 .ne 2
634 \fB\fB0\fR \fR
636 .RS 7n
637 Successful completion.
641 .ne 2
643 \fB\fB>0\fR \fR
645 .RS 7n
646 An error occurred.
649 .SH ATTRIBUTES
652 See \fBattributes\fR(5) for descriptions of the following attributes:
653 .SS "/usr/bin/od"
658 box;
659 c | c
660 l | l .
661 ATTRIBUTE TYPE  ATTRIBUTE VALUE
663 CSI     enabled
666 .SS "/usr/xpg4/bin/od"
671 box;
672 c | c
673 l | l .
674 ATTRIBUTE TYPE  ATTRIBUTE VALUE
676 CSI     enabled
678 Interface Stability     Standard
681 .SH SEE ALSO
684 \fBsed\fR(1), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)