Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Linux od command

Linux od command

Linux Command Reference Linux Command Reference

The Linux od command is used to output file contents.

The od command reads the contents of the given file and presents them as octal byte codes.

Syntax

od [-abcdfhilovx][-A <字码基数>][-j <字符数目>][-N <字符数目>][-s <字符串字符数>][-t <输出格式>][-w <每列字符数>][--help][--version][文件...]

Parameters:

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 that 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 codes, noting that escape characters are included



$ 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

Linux Command Reference Linux Command Reference