linux hexdump使用
2024-09-20 06:36:38
# hexdump -h
hexdump: invalid option -- 'h' Usage:
hexdump [options] file... Options:
-b one-byte octal display#单字节八进制显示
-c one-byte character display#单字节字符显示
-C canonical hex+ASCII display#规范化 十六进制+ASCII 显示
-d two-byte decimal display#两字节十进制显示
-o two-byte octal display#两字节八进制显示
-x two-byte hexadecimal display#两字节十六进制显示
-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#长度 只解释输入的指定长度个字节
-s offset skip offset bytes from the beginning#偏移 跳过开头指定长度个字节
-v display without squeezing similar lines#显示时不压缩相似的行
-V output version information and exit#显示此帮助并退出
# more a.txt
abcde
ABCDE
# hexdump a.txt
0000000 6261 6463 0a65 4241 4443 0a45
000000c
第一列表示:文件偏移量
第二列表示:以两个字节为一组的十六进制
上面的输出结果翻译一下,就是:
badc0aeBADC0aE
(注意:在Linux中换行符\n 的十六进制为0a,在windows中,换行为\r\n的十六进制编码为:0d 0a)
为什么翻译成文本成倒序了呢?
其实这是CPU架构所致,感兴趣的可以看下大小端的定义:
1) Little-Endian就是低位字节排放在内存的低地址端,高位字节排放在内存的高地址端。(X86 CPU系列采用的位序)
2) Big-Endian就是高位字节排放在内存的低地址端,低位字节排放在内存的高地址端。
3) 网络字节序:TCP/IP各层协议将字节序定义为Big-Endian,因此TCP/IP协议中使用的字节序通常称之为网络字节序。
有没有更加较便于方便的查看方式了?有,这也是较常用的方式。
以16进制和相应的ASCII字符显示文件里的字符:
# hexdump -C a.txt
00000000 61 62 63 64 65 0a 41 42 43 44 45 0a |abcde.ABCDE.|
0000000c
最新文章
- SVN源码泄露漏洞
- ACM 笨小熊
- Yii路径总结
- 关于停止AsyncTask和Thread的问题
- Shell good example
- hiho一下 第九十八周 搜索一·24点
- uvalive 4255 Guess(拓扑排序)
- SharedPreference.Editor的apply与commit方法不同之处
- JavaSE(十)集合之List
- MQTT——入门介绍
- 获得只有 [年 月 日] 的Date 对象
- PyCharm 2018.1破解过程
- Python两大佬互相撕逼 技术何苦为难技术?
- django(channel)到 ubuntu
- 【第二组】Hunter——beta版发布文档
- zabbix3.4.7页面中文乱码
- hyperledger
- js 操作数字类型
- Flask租房项目总结
- 介绍nodejs中的path模块的几个方法