hexdump常用参数

简介:

在分析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



案例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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









本文转自 lirulei90 51CTO博客,原文链接:http://blog.51cto.com/lee90/1979067,如需转载请自行联系原作者
目录
相关文章
|
6月前
|
Java
参数
在Java中,形式参数是函数或方法的参数。形式参数是在定义函数或方法时指定的变量,它们的作用是接收函数或方法调用时传递的实际参数的值。形式参数和实际参数是不同的,形式参数是在函数或方法内部使用的,而实际参数是在函数或方法调用时传递的值。
38 1
|
3月前
|
Java C++ Python
函数的参数列表
函数的参数列表
60 2
|
6月前
VideoId”参数无效
VideoId”参数无效
95 1
|
11月前
|
API Python
一日一技:如何正确使用 re.sub 的第二个参数
一日一技:如何正确使用 re.sub 的第二个参数
60 0
|
Java Scala 开发者
作为参数的函数 | 学习笔记
快速学习作为参数的函数
44 0
|
开发者 Python
函数的参数| 学习笔记
快速学习函数的参数
60 0
|
测试技术 Android开发
怎么知道方法的参数有哪些类型呢?
怎么知道方法的参数有哪些类型呢?
179 0
self.doubleSpinBox.setGeometry(QtCore.QRect(20, 25, 101, 22))参数讲解
self.doubleSpinBox.setGeometry(QtCore.QRect(20, 25, 101, 22))参数讲解
283 0
7.2 函数的参数
1、给 b 变量设定一个默认的值 如果实参传入的时候,指定了 b 的值,那 b 优先选择传入的实参,当 b 没有值时,才会用默认值 def funcA(a,b=0):     print(a)     print(b) funcA(1)        # b 变量选择默认实参...
597 0