od - Dump files in various formats

Synopsis

od [-A address_base] [-j skip] [-N count] [-t type_string] [-Cbcdosvx] [file...]

Description

The od utility writes the contents of the specified files to standard output in a user-specified format. If the file parameter is not given, the od command reads standard input. The format is specified by the -t flag. If no format type is specified, -t oS is the default.

Options

-A address_base
Specifies the format for the output offset base. The address_base can be one of these values:

In the case of n, the offset base is not displayed. If -A is not specified, -A o is the default.

-b
Output bytes in octal. It is equivalent to -t 01.
-C
Display the CCSID of the file to standard output before the rest of the output is written.
-c
Output bytes as characters. It is equivalent to -t c.
-d
Output bytes in unsigned decimal. It is equivalent to -t u2.
-j skip
Specifies the number of bytes to skip before beginning to display output. If more than one file is specified, the number of bytes will be used on the concatenated input of all files specified. An error will occur if this number is larger than the size of the concatenated inputs. This value can be specified in hexadecimal (preceded by 0x or 0X), octal (preceded by 0), or decimal (default).
-N count
Specifies the number of bytes to be written. By default, the whole file will be written. This value can be specified in hexadecimal (preceded by 0x or 0X), octal (preceded by 0), or decimal (default).
-o
Output bytes in octal. It is equivalent to -t o2.
-s
Output bytes in signed decimal. It is equivalent to -t d2.
-t type_string
Specifies one or more output types. The type specified must be a string containing all of the formatting types that you want. The type_string can contain these values:

The type specifications of a and c may give unexpected results since they depend on the CCSID on the data. The a type specifier displays non-printable characters as named characters. The c type specifier displays non-printable characters as three digit octal numbers.

The type specifications of d, o, u and x can also be followed by 1, 2, 4, C, S, I or L. These specify the number of bytes to be transformed by each instance of the output type. The values C, S, I and L correspond to char, short, int and long.

The type specification of f can be followed by by 4, 8, F, D or L. These specify the number of bytes to be transformed by each instance of the output type. The values F, D and L correspond to float, double, and long double. If -t is not specified, the default is -t oS.

-v
Write all input data. Without this option, repeated output lines will not be written. When repeats occur, only an asterisk (*) will be written.
-x
Output bytes in hexadecimal. It is equivalent to -t x2.

Operands

Each file is a path name of an object to be written to standard output. If no file operands are specified, standard input will be used.

Exit Status

Related information

Examples

  1. Dump a file in hexadecimal format.
    od -tx output.txt
    
  2. Dump the first 50 bytes of a file.
    od -N50 output.txt
    
  3. Skip the first 100 bytes and then dump the rest of a file.
    od -j100 output.txt
    
  4. Dump a file in both hexadecimal and character format.
    od -tx1 -tc output.txt