Name

od — stdin  stdout  - file  -- opt  --help  --version

Synopsis

od [options] [files]

When you want to view a binary file, consider od (Octal Dump) for the job. It copies one or more files to standard output, displaying their data in ASCII, octal, decimal, hexadecimal, or floating point, in various sizes (byte, short, long). For example, this command:

$ od -w8 /usr/bin/who
0000000 042577 043114 000401 000001
0000010 000000 000000 000000 000000
0000020 000002 000003 000001 000000
...

displays the bytes in binary file /usr/bin/who in octal, eight bytes per line. The column on the left contains the file offset of each row, again in octal.

If your binary file also contains text, consider the -tc option, which displays character data. For example, binary executables like who contain the string “ELF” at the beginning:

$ od -tc -w8 /usr/bin/who | head -3
0000000 177   E   L   F 001 001 001  
0000010                
0000020 002   003   001      

Useful options

-N B

Display only the first B bytes of each file, specified in decimal, hexadecimal (by prepending 0x or 0X), 512-byte blocks (by appending b), kilobytes (by appending k), or megabytes (by appending m). (Default displays the entire file.)

-j B

Begin the output at byte B +1 of each file; acceptable formats are the same as for the -N option. (Default=0)

-w [ B ]

Display B bytes per line; acceptable formats are the same as in the -N option. Using -w by itself is equivalent to -w32. (Default=16)

-s [ B ]

Group each row of bytes into sequences of B bytes, separated by whitespace; acceptable formats are the same as in the -N option. Using -s by itself is equivalent to -s3. (Default=2)

-A (d|o|x|n)

Display file offsets in the leftmost column, in decimal (d), octal (o), hexadecimal (h), or not at all (n). (Default=o)

-t (a|c)[z]

Display output in a character format, with nonalphanumeric characters printed as escape sequences (c) or by name (a). For z, see below.

-t (d|o|u|x)[SIZE[z]]

Display output in an integer format, including octal (o), signed decimal (d), unsigned decimal (u), hexadecimal (x). (For binary output, use xxd instead.) SIZE represents the number of bytes per integer; it can be a positive integer or any of the values C, S, I, or L, which stand for the size of a char, short, int, or long datatype, respectively. For z, see below.

-t f[SIZE[z]]

Display output in floating point. SIZE represents the number of bytes per integer; it can be a positive integer or any of the values F, D, or L, which stand for the size of a float, double, or long double datatype, respectively. For z, see below. If -t is omitted, the default is -to2.

Appending z to the -t option prints a new column on the right-hand side of the output, displaying the printable characters on each line, much like the default output of xxd.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.84.155