Linux od Command
The Linux od command is used to output file contents.
The od command reads the contents of the given file and displays them in octal code.
Syntax
od [-abcdfhilovx][-A <code base>][-j <byte count>][-N <byte count>][-s <string char count>][-t <output format>][-w <char count per line>][--help][--version][files...]
Parameters:
-a This parameter has the same effect as specifying "-ta" together.
-A<code base> Selects the base for code calculation.
-b This parameter has the same effect as specifying "-toC" together.
-c This parameter has the same effect as specifying "-tC" together.
-d This parameter has the same effect as specifying "-tu2" together.
-f This parameter has the same effect as specifying "-tfF" together.
-h This parameter has the same effect as specifying "-tx2" together.
-i This parameter has the same effect as specifying "-td2" together.
-j<byte count> or --skip-bytes=<byte count> Skips the specified number of bytes.
-l This parameter has the same effect as specifying "-td4" together.
-N<byte count> or --read-bytes=<byte count> Reads up to the specified number of bytes.
-o This parameter has the same effect as specifying "-to2" together.
-s<string char count> or --strings=<string char count> Displays only strings that match the specified number of characters.
-t<output format> or --format=<output format> Sets the output format.
-v or --output-duplicates Outputs without omitting duplicate data.
-w<char count per line> or --width=<char count per line> Sets the maximum number of characters per line.
-x This parameter has the same effect as specifying "-h" together.
--help Online help.
--version Displays version information.
Example
Create a tmp file:
$ echo abcdef g > tmp
$ cat tmp
abcdef g
Use the od command:
$ od -b tmp
0000000 141 142 143 144 145 146 040 147 012
0000011
Output using single-byte octal interpretation, note the default address format on the left is eight bytes:
$ od -c tmp
0000000 a b c d e f g \n
0000011
Output using ASCII code, note including escape characters:
$ od -t d1 tmp
0000000 97 98 99 100 101 102 32 103 10
0000011
Interpret using single-byte decimal:
$ od -A d -c tmp
0000000 a b c d e f g \n
0000009