|Linux / Unix Command: od|
od - dump files in octal and other formatsSYNOPSIS
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...]DESCRIPTION
octal dump displays contents as octal numbers. This can be useful when the output contains non-printable characters. For example, a filename may contain non-printable characters. It can also be handy to view binary files.OPTIONS
Select the base in which file offsets are printed.
radix can be one of the following:
The default is octal. -j, --skip-bytes=bytes
- d decimal
- o octal
- x hexadecimal
- n none (do not print offsets)
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 below 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
- C char
- S short
- I int
- L long
- For floating point (f):
- F float
- D double
- L long double
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,
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
Print a usage message and exit with a status code indicating success.
Print version information on standard output then exit.
Output as named characters. Equivalent to -t a.
Output as octal bytes. Equivalent to -t oC.
Output as ASCII characters or backslash escapes.
Equivalent to -t c.
Output as unsigned decimal shorts. Equivalent to -t u2.
Output as floats. Equivalent to -t fF.
Output as hexadecimal shorts. Equivalent to -t x2.
Output as decimal shorts. Equivalent to -t d2.
Output as decimal longs. Equivalent to -t d4.
Output as octal shorts. Equivalent to -t o2.
-x Output as hexadecimal shorts. Equivalent to -t x2.
(see man pages for more information)
% dir | od -c | moreComparison of different outputs:
% cat my_file | od -c |more
% od my_file |more
Show 16 first characters from a binary file (/bin/sh) as ASCII characters or backslash escapes (octal):
% od -N 16 -c /bin/shoutput:0000000 177 E L F 001 001 001 \0 \0 \0 \0 \0 \0 \0 \0 \0Show the same binary as named ASCII characters:
% od -N 16 -a /bin/shoutput:
0000000 del E L F soh soh soh nul nul nul nul nul nul nul nul nulShow the same binary as short hexcadecimals:
% od -N 16 -t x1 /bin/shoutput:
0000000 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00Show the same binary as octal numbers:
% od -N 16 /bin/shoutput:
% 0000000 042577 043114 000401 000001 000000 000000 000000 000000
Important: Use the man command (% man) to see how a command is used on your particular computer.