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 its contents in octal characters.
Syntax
od [-abcdfhilovx][-A <字码基数>][-j <字符数目>][-N <字符数目>][-s <字符串字符数>][-t <输出格式>][-w <每列字符数>][--help][--version][文件...]
Options:
- -a This option has the same effect as specifying the "-ta" option at the same time.
- -A<radix> Selects the base to be used for calculating character codes.
- -b This option has the same effect as specifying the "-toC" option at the same time.
- -c This option has the same effect as specifying the "-tC" option at the same time.
- -d This option has the same effect as specifying the "-tu2" option at the same time.
- -f This option has the same effect as specifying the "-tfF" option at the same time.
- -h This option has the same effect as specifying the "-tx2" option at the same time.
- -i This option has the same effect as specifying the "-td2" option at the same time.
- -j<number of characters> or --skip-bytes=<number of characters> Skips the set number of characters.
- -l This option has the same effect as specifying the "-td4" option at the same time.
- -N<number of characters> or --read-bytes=<number of characters> Reads up to the set number of characters.
- -o This option has the same effect as specifying the "-to2" option at the same time.
- -s<string character count> or --strings=<string character count> Only displays strings that meet the specified character count.
- -t<output format> or --format=<output format> Sets the output format.
- -v or --output-duplicates Does not omit duplicate data when outputting.
- -w<number of characters per column> or --width=<number of characters per column> Sets the maximum number of characters per column.
- -x This option has the same effect as specifying the "-h" option at the same time.
- --help Online help.
- --version Displays version information.
Examples
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 that the default address format on the left is octal:
$ od -c tmp 0000000 a b c d e f g \n 0000011
Use ASCII codes for output, noting that escape characters are included.
$ od -t d1 tmp 0000000 97 98 99 100 101 102 32 103 10 0000011
Use single-byte decimal for interpretation.
$ od -A d -c tmp 0000000 a b c d e f g \n 0000009Other Extensions
Linux Command Complete Guide