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]] |
(verbose) Shows all data. -v not specified
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.
(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.
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.
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).
Name of the file to be dumped. file not specified: |
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.
Interprets each byte as an octal number.
Interprets each byte in accordance with the current setting for LC_CTYPE.
Interprets each group of 2 bytes as an unsigned decimal number.
Interprets each group of 4 bytes as an unsigned decimal number.
Interprets each group of 4 bytes as a floating-point number.
Interprets each group of 8 bytes as an extended precision number.
Interprets each group of 2 bytes as an unsigned octal number.
Interprets each group of 4 bytes as an unsigned octal number.
Interprets each group of 2 bytes as a signed decimal number.
Interprets each group of 4 bytes as a signed decimal number.
(verbose) Shows all data. -v not specified
Each 2-byte sequence is interpreted as an unsigned hexadecimal number.
Each 4-byte sequence is interpreted as an unsigned hexadecimal number.
Name of the file to be dumped. file not specified:
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. offset not specified: |
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:
|
Example 2
Display the contents of the file text in octal form and as ASCII characters from the sixth byte onward:
|
See also
Tables and directories, EBCDIC character set |