Module 97 od

Previous Table of Contents Next


Module 97
od

DESCRIPTION

The external od command provides a way to view the contents of a file byte-by-byte or word-by-word . A byte is eight bits and a word is two bytes (16 bits). The format of each byte or word can be octal, decimal, hexadecimal, or ASCII. You can use od to display a file that has special character sequences, such as control characters or extended ASCII characters .


NOTE:    
The od command displays bytes and words of information. These display formats are not dependent upon the computer hardware.

COMMAND FORMAT

Following is the general format of the od command.

 od [ -bcDdFfOoSsXx ] [ file ] [ [+]offset[.][b] ] 

BSD (Berkeley)
od [ -a[pP]bcdfhilovx ] [ -w[n] ] [ -s[n] ] [ file ] \
[ [+]offset[.][bx] [ [+]label[.][bx] ] ]

Options

The following list describes the options and their arguments that may be used to control how od functions.

-b Displays each byte in octal format. For example, a file (pups) containing the word PUPPIES is displayed as
od -b pups
000000 120 125 120 120 111 105 123 012
The first set of zeros is the address of the first byte displayed on the current line. The 120 is the octal representation for P.
-c Displays each byte in its ASCII character format. Nonprinting characters have the following special representations.
Notation Meaning ASCII Label
\0 Null NUL
\b Backspace BS
\f Formfeed FF
\n New-line NL
\r Carriage Return CR
\t Tab HT
\ooo Octal Representation of character
All nonprintable characters that do not have a special symbol are represented using their octal representation.
-D Displays each word in unsigned decimal format.
-d Displays each long word in unsigned decimal format. For example,
od -d pups
000000 080085 080080 073069 083010
-O Displays each long word in octal format.
-o Displays each word in octal format. This is the default if you do not specify any options.
-S Displays each long word in signed decimal.
-s Displays each word as signed decimal.
-v Verbose. Displays all data. By default duplicate lines are replaced with an asterisk (*) in column 1.
-X Displays each long word in hexadecimal.
-x Displays each word as hexadecimal.
[+] offset [.][b] The + sign must be used if no file is specified. The offset is the number of bytes to skip before displaying information. By default the offset is interpreted as octal. The . (period) option changes the meaning of the offset to be decimal instead of octal. The b option changes the offset to be calculated in blocks (512 bytes) instead of bytes. Dumping continues until the end-of-file is reached.

BSD (Berkeley)
-a[pP] Displays bytes as ASCII names . If p is specified, bytes with even parity are underlined. If P is specified, bytes with odd parity are underlined .
-b Same as System V
-d Same as System V
-f Displays long words as floating point.
-h Displays words as unsigned hexadecimal.
-i Displays words as signed decimal.
-l Displays words as signed decimal.
-o Same as System V
-v Same as System V
-x Displays words as hexadecimal.
-s[ n ] Display strings of ASCII graphic characters, null terminated . The minimum string length is set to n , the default for n is 3.
-w[ n ] Display n input bytes on one line of output. If -w is not used the default is 16 bytes. If -w is specified without n the width is set to 32 bytes.
[+] offset [.][b][x] The same as SV with the addition of x. If x or 0x is specified, the offset is calculated in hexadecimal.
[+] label [.][b][x] Same as the offset option except it is intended for use with core images to indicate the real memory address.

Arguments

The following describes the argument that may be passed to the od command.

file The name of the input file to be displayed in od format.
If no file is specified od reads from the standard input. Thus you can use od to read input from a pipe or straight off your keyboard. If you use it from your keyboard, no output is displayed until you press Return or Ctrl-D.

RELATED COMMANDS

The cat command with the -v option performs a similar function provided by the od -c command.


Previous Table of Contents Next

Copyright Wordware Publishing, Inc.


Illustrated UNIX System V
Illustrated Unix System V/Bsd
ISBN: 1556221878
EAN: 2147483647
Year: N/A
Pages: 144
Authors: Robert Felps

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net