语法
od [-abcdfhilovx][-A ][-j ][-N ][-s ][-t ][-w ][--help][--version][文件...]
参数:
-
-a 此参数的效果和同时指定”-ta”参数相同。
-
-A 选择要以何种基数计算字码。
-
-b 此参数的效果和同时指定”-toC”参数相同。
-
-c 此参数的效果和同时指定”-tC”参数相同。
-
-d 此参数的效果和同时指定”-tu2″参数相同。
-
-f 此参数的效果和同时指定”-tfF”参数相同。
-
-h 此参数的效果和同时指定”-tx2″参数相同。
-
-i 此参数的效果和同时指定”-td2″参数相同。
-
-j或–skip-bytes= 略过设置的字符数目。
-
-l 此参数的效果和同时指定”-td4″参数相同。
-
-N或–read-bytes= 到设置的字符数目为止。
-
-o 此参数的效果和同时指定”-to2″参数相同。
-
-s或–strings= 只显示符合指定的字符数目的字符串。
-
-t或–format= 设置输出格式。
-
-v或–output-duplicates 输出时不省略重复的数据。
-
-w或–width= 设置每列的最大字符数。
-
-x 此参数的效果和同时指定”-h”参数相同。
-
–help 在线帮助。
-
–version 显示版本信息。
案例演示:
[linuxde@localhost ~]$ echo abcdef g > tmp [linuxde@localhost ~]$ cat tmp abcdef g
说明:先准备一个tmp文件
[linuxde@localhost ~]$ od -b tmp 0000000 141 142 143 144 145 146 040 147 012 0000011
说明:使用单字节八进制解释进行输出,注意左侧的默认地址格式为八字节
[linuxde@localhost ~]$ od -c tmp 0000000 a b c d e f g \n 0000011
说明:使用ASCII码进行输出,注意其中包括转义字符
[linuxde@localhost ~]$ od -t d1 tmp 0000000 97 98 99 100 101 102 32 103 10 0000011
说明:使用单字节十进制进行解释
[linuxde@localhost ~]$ od -A d -c tmp 0000000 a b c d e f g \n 0000009
说明:设置地址格式为十进制。
[linuxde@localhost ~]$ od -A x -c tmp 000000 a b c d e f g \n 000009
说明:设置地址格式为十六进制
[linuxde@localhost ~]$ od -j 2 -c tmp 0000002 c d e f g \n 0000011
说明:跳过开始的两个字节
[linuxde@localhost ~]$ od -N 2 -j 2 -c tmp 0000002 c d 0000004
说明:跳过开始的两个字节,并且仅输出两个字节
[linuxde@localhost ~]$ od -w1 -c tmp 0000000 a 0000001 b 0000002 c 0000003 d 0000004 e 0000005 f 0000006 0000007 g 0000010 \n 0000011
说明:每行仅输出1个字节
[linuxde@localhost ~]$ od -w2 -c tmp 0000000 a b 0000002 c d 0000004 e f 0000006 g 0000010 \n 0000011
说明:每行输出两个字节
[linuxde@localhost ~]$ od -w3 -b tmp 0000000 141 142 143 0000003 144 145 146 0000006 040 147 012 0000011
以上就是
为各位朋友分享的 相关内容。想要了解更多Linux相关知识记得关注公众号“良许Linux”,或扫描下方二维码进行关注,更多 等着你!