Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

od - dump files in various formats

&pagelevel(4)&pagelevel

The od command dumps (i.e. writes the contents of) a file on the standard output in an output format that you select with command-line options.

The first column of each output line specifies the position of the first character in this line. Characters can be specified in octal, decimal or hexadecimal, depending on the indicated output format.


Syntax


Format 1:od[ -v][ -A addr_base][ -j skip][ -N count][ -t type_string][ file...]
Format 2:od[ -bcdDfFoOsSvxX] [ file] [ [+]offset[.][b]]



Format 1:od[ -v][ -A addr_base][ -j skip][ -N count][ -t type_string][ file...]


-v

(verbose)

Shows all data.

-v not specified
All output lines which are identical to the immediately preceding output lines are replaced by a line which contains only an asterisk (*).

-A addr_base

Identifies the offset base for the input. addr_base is a character. The characters o, d and x mean that the offset base is written in octal, decimal or hexadecimal notation. The character n means that no offset is written.

-j skip

(jump)

The next skip bytes from the start of the input are jumped. If the input is not at least skip bytes in length, an error message is output. By default, skip is interpreted as a decimal number. If skip begins with 0x or 0X then the offset is interpreted as a hexadecimal number. If skip begins with a leading zero then the offset is interpreted as an octal number. If this is followed by one of the characters b, k or m then the offset is interpreted as a multiple of 512, 1024 or 1048576 bytes.

-N count

Only count bytes of the input are formated. By default, count is interpreted as a decimal number. If count begins with 0x or 0X then the offset is interpreted as a hexadecimal number. If count begins with a leading zero then the offset is interpreted as an octal number. If fewer than count bytes are present, no error message is output and od simply formats the available input.

-t type_string

Identifies one or more output types. type_string consists of a string which identifies the types used for input. The string must consist of the type-specific characters a (named character), c (character), d (decimal), f (floating) , o (octal), u (unsigned decimal) und x (hexadecimal).

file

Name of the file to be dumped.

file not specified:
od reads from standard input.



Format 2:od[ -bcdDfFoOsSvxX] [ file] [ [+]offset[.][b]]


No option specified

Each group of 2 bytes is interpreted as an unsigned octal number (same as option -o).

option

If you use several options in order to combine different output formats, the option sign (-) may only be specified once, and the option names must be grouped together without intervening blanks, e.g: od -bcs file.

-b

Interprets each byte as an octal number.

-c

Interprets each byte in accordance with the current setting for LC_CTYPE.

-d

Interprets each group of 2 bytes as an unsigned decimal number.

-D

Interprets each group of 4 bytes as an unsigned decimal number.

-f

Interprets each group of 4 bytes as a floating-point number.

-F

Interprets each group of 8 bytes as an extended precision number.

-o

Interprets each group of 2 bytes as an unsigned octal number.

-O

Interprets each group of 4 bytes as an unsigned octal number.

-s

Interprets each group of 2 bytes as a signed decimal number.

-S

Interprets each group of 4 bytes as a signed decimal number.

-v

(verbose)

Shows all data.

-v not specified
All output lines which are identical to the immediately preceding output lines are replaced by a line which contains only an asterisk (*).

-x

Each 2-byte sequence is interpreted as an unsigned hexadecimal number.

-X

Each 4-byte sequence is interpreted as an unsigned hexadecimal number.

file

Name of the file to be dumped.

file not specified:
od reads from standard input.

offset

The offset argument specifies the offset in the file where dumping is to commence.

offset is normally interpreted in octal bytes. If a period (.) is appended to the offset argument, the offset is interpreted in decimal. If b is appended, the offset is interpreted in blocks of 512 bytes.
If the file argument is omitted, the offset argument must be preceded by a plus sign (+) to prevent it from being interpreted as a file name.

offset not specified:
Dumping commences at the start of the file.

Locale

The following environment variables affect the execution of od:

LANG

Provide a default value for the internationalization variables that are unset or null. If LANG is unset of null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization variables contains an invalid setting, the utility will behave as if none of the variables had been defined.

LC_ALL

If set to a non-empty string value, override the values of all the other internationalization variables.

LC_CTYPE

Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments and input files), the classification of characters as upper- to lower-case, and the mapping of characters from one case to the other.

LC_MESSAGES

Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.

LC_NUMERIC

Determine the locale for selecting the radix character used when writing floating point formatted output.

NLSPATH

Determine the location of message catalogs for the processing of LC_MESSAGES.

Example 1

Unsigned octal dump of the contents of file text:

$ cat text
Keep a stiff upper lip.

$ od text

0000000 151205 102627 040201 040242 121611 103206 040244 113627

0000020 102631 040223 104627 012400

0000027

Example 2

Display the contents of the file text in octal form and as ASCII characters from the sixth byte onward:

$ od -bc text 5.

0000005 201 100 242 243 211 206 206 100 244 227 227 205 231 100 223 211

          a       s   t   i   f   f       u   p   p   e   r       l   i
0000021 227 025

           p  \n

0000023

See also

Tables and directories, EBCDIC character set