前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >hexdump常用参数

hexdump常用参数

作者头像
保持热爱奔赴山海
发布2019-09-18 14:51:16
1.3K0
发布2019-09-18 14:51:16
举报
文章被收录于专栏:饮水机管理员饮水机管理员

在分析mysql binlog或者ibd文件时候,常会用到hexdump 查看物理文件的存储内容。

参考:http://www.cnblogs.com/kerrycode/p/5077687.html

node1:~ # hexdump --help  (常用下面3个红色标注的参数)

hexdump: invalid option -- '-'

Usage:

hexdump [options] file...

Options:

-b              one-byte octal display           8进制显示

-c              one-byte character display       ASCII显示

-C              canonical hex+ASCII display       十六进制+ASCII显示

-d              two-byte decimal display        两字节计算,显示为10进制方式

-o              two-byte octal display         两字节计算,显示为8进制方式

-x              two-byte hexadecimal display    两字节计算,显示为16进制方式

-e format       format string to be used for displaying data   格式化输出

-f format_file  file that contains format strings

-n length       interpret only length bytes of input    输出多少个bytes的字符长度的内容

-s offset       skip offset bytes from the beginning    输出文件的开始偏移量  【注意:偏移量从0开始的!】

-v              display without squeezing similar lines    

-V              output version information and exit

案例:

代码语言:javascript
复制
cat > test.txt < EOF
AbCDEF
GHIJKL
123456
EOF

[root@node1 ~]$ hexdump -b test.txt
0000000 101 142 103 104 105 106 012 107 110 111 112 113 114 012 061 062
0000010 063 064 065 066 012
[root@node1 ~]$ hexdump -c test.txt   可以看到\n表示文件中有换行(注意:linux下换行是\n  windows下换行是\r\n)
0000000   A   b   C   D   E   F  \n   G   H   I   J   K   L  \n   1   2
0000010   3   4   5   6  \n                                            
0000015

[root@node1 ~]$ hexdump -C test.txt
00000000  41 62 43 44 45 46 0a 47  48 49 4a 4b 4c 0a 31 32  |AbCDEF.GHIJKL.12|
00000010  33 34 35 36 0a                                    |3456.|
00000015

[root@node1 ~]$ hexdump -d test.txt
0000000   25153   17475   17989   18186   18760   19274   02636   12849
0000010   13363   13877   00010                                        
0000015

[root@node1 ~]$ hexdump -C -s 0 -n 3 test.txt
00000000  41 62 43                                          |AbC|
00000003

[root@node1 ~]$ hexdump -C -s 8  test.txt   从偏移量8开始输出全部内容
00000008  48 49 4a 4b 4c 0a 31 32  33 34 35 36 0a           |HIJKL.123456.|
00000015
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2017-11-05 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档