Home » Linux Command Reference » UNIX/LINUX Command – od

UNIX/LINUX Command – od


od—Dump files in octal and other formats


od [–abcdfhiloxv] [–s[bytes]] [–w[bytes]] [–A radix] [–j bytes] [–N bytes] [–t type] [–skip–bytes=bytes] [–address–radix=radix] [–read–bytes=bytes] [–format=type] [–output–duplicates] [–strings[=bytes]] [–width[=bytes]] [–traditional] [–help] [–version] [file…]


This manual page documents the GNU version of od. od writes to the standard output the contents of the given files, or of the standard input if the name – is given. Each line of the output consists of the offset in the input file in the leftmost column of each line, followed by one or more columns of data from the file, in a format controlled by the options. By default, od prints the file offsets in octal and the file data as two-byte octal numbers.


Options Description
–A, –address–radix=radix Select the base in which file offsets are printed. radix can be one of the following:
d       Decimal
o       Octal
x       Hexadecimal
n       None (do not print offsets)
The default is octal.
–j, –skip–bytes=bytes Skip bytes input bytes before formatting and writing. If bytes begins with 0x or 0X, it is interpreted in hexadecimal; otherwise, if it begins with 0, in octal; otherwise, in decimal.Appending b multiplies it by 512, k by 1024, and m by 1048576.
–N, –read–bytes=bytes Only output up to bytes bytes of each input file. Any prefixes and suffixes on bytes are interpreted as for the –j option.
–t, –format=type Select the format in which to output the file data. type is a string of one or more of the following type indicator characters. If you include more than one type indicator character in a single type string or use this option more than once, od writes one copy of each output line using each of the data types that you specified, in the order that you specified.
a        Named character
c        ASCII character or backslash escape
d        Signed decimal
f         Floating point
o        Octal
u        Unsigned decimal
x         Hexadecimal
Except for types a and c, you can specify the number of bytes to use in interpreting each number in the given data type by following the type indicator character with a decimal integer. Alternately, you can specify the size of one of the C compiler’s built-in data types by following the type indicator character with one of the following characters. For integers (d, o, u, x):
C       char
S        short
I         int
L        long
For floating point (f):
F        float
D        double
L         long double
–v, –output–duplicates Output consecutive lines that are identical. By default, when two or more consecutive output lines would be equal, od outputs only the first line, and puts just an asterisk on the following line to indicate that identical lines have been elided.
–s, –strings[=bytes] Instead of the normal output, output only string constants in the input, which are a run of at least bytes ASCII graphic (or formatting) characters, terminated by a NUL. If bytes is omitted, it defaults to 3.
–w, –width[=bytes] The number of input bytes to format per output line. It must be a multiple of the least common multiple of the sizes associated with the specified output types. If bytes is omitted, it defaults to 32. If this option is not given, it defaults to 16.
–help Print a usage message and exit with a nonzero status.
–version Print version information on standard output, then exit.

 The next several options map the old, pre-POSIX format specification options to the corresponding POSIX format specs. GNU od accepts any combination of old- and new-style options. Format specification options accumulate.

Options Description
–a Output as named characters. Equivalent to –t a.
–b Output as octal bytes. Equivalent to –t oC.
–c Output as ASCII characters or backslash escapes. Equivalent to –t c.
–d Output as unsigned decimal shorts. Equivalent to –t u2.
–f Output as floats. Equivalent to –t fF.
–h Output as hexadecimal shorts. Equivalent to –t x2.
–i Output as decimal shorts. Equivalent to –t d2.
–l Output as decimal longs. Equivalent to –t d4.
–o Output as octal shorts. Equivalent to –t o2.
–x Output as hexadecimal shorts. Equivalent to –t x2.
–traditional Recognize the pre-POSIX nonoption arguments that some older versions of od accepted. The following syntax:
od –traditional [ file] [[+]offset[.][b] [[+]label[.][b]]]
can be used to specify at most one file and optional arguments specifying an offset and a pseudo-start address, label. By default, offset is interpreted as an octal number specifying how many input bytes to skip before formatting and writing. The optional trailing decimal point forces the interpretation of offset as a decimal number. If no decimal is specified and the offset begins with 0x or 0x, it is interpreted as a hexadecimal number. If there is a trailing b, the number of bytes skipped will be offset multiplied by 512. The label argument is interpreted just like offset, but it specifies an initial pseudo-address. The pseudo addresses are displayed in parentheses following any normal address.

Related Posts

UNIX/LINUX Command – rsync

UNIX/LINUX Command – rsync

NAME rsync – a fast, versatile, remote (and local) file-copying tool rsync Command SYNOPSIS Local: rsync [OPTION…] SRC… [DEST] Access via remote shell:Pull: rsync [OPTION…] [USER@]HOST:SRC… [DEST]Push: rsync [OPTION…] SRC… [USER@]HOST:DEST Access via rsync...

UNIX/LINUX Command – strip

UNIX/LINUX Command – strip

NAME strip—Discard symbols from object files. SYNOPSIS strip [ -Fbfdname|–target=bfdname ] [ -Ibfdname|–input-target=bfdname ] [ -Obfdname|–output-target=bfdname ] [-Rsectionname|–remove-section=sectionname ] [ -s|–strip-all ] [-S|-g|–strip-debug ][-x|–discard-all...

UNIX/LINUX Command – expand

UNIX/LINUX Command – expand

NAME expand—Convert tabs to spaces SYNOPSIS expand [–tab1[,tab2[,…]]] [–t tab1[,tab2[,…]]] [–i] [—tabs=tab1[,tab2[,…]]] [–initial] [–help] [–version] [file…] DESCRIPTION This manual page documents the GNU version of expand. expand writes the contents of each given...

UNIX/LINUX Command – uuencode

UNIX/LINUX Command – uuencode

NAME uuencode—Encode a binary fileuudecode—Decode a file created by uuencode SYNOPSIS uuencode [-m] [ file ] nameuudecode [-o outfile] [ file ]… DESCRIPTION uuencode and uudecode are used to transmit binary files over transmission mediums that do not support other...

Follow Us

Our Communities

The Ultimate Managed Hosting Platform
Load WordPress Sites in as fast as 37ms!



Submit a Comment

Your email address will not be published. Required fields are marked *

twenty + 11 =