Linux hexdump命令

hexdump是Linux下的一个二进制文件查看工具,它可以将二进制文件转换为ASCII、八进制、十进制、十六进制格式进行查看。

查看hexdump帮助:

hexdump -h
hexdump --help
man hexdump
$ man hexdump


NAME
       hexdump - display file contents in hexadecimal, decimal, octal, or ascii

SYNOPSIS
       hexdump [options] file...

Options:
-b, --one-byte-octal one-byte octal display
-c, --one-byte-char one-byte character display
-C, --canonical canonical hex+ASCII display
-d, --two-bytes-decimal two-byte decimal display
-o, --two-bytes-octal two-byte octal display
-x, --two-bytes-hex two-byte hexadecimal display
-L, --color[=<mode>] interpret color formatting specifiers
colors are enabled by default
-e, --format <format> format string to be used for displaying data
-f, --format-file <file> file that contains format strings
-n, --length <length> interpret only length bytes of input
-s, --skip <offset> skip offset bytes from the beginning
-v, --no-squeezing output identical lines


-h, --help display this help
-V, --version display version

-b,--1字节八进制1字节八进制显示

[root@localhost queue]# hexdump -b id\:000000\,orig\:seed.bin
0000000 355 325 313 155 055 350 104 114 275 241 161 224 031 232 331 052
0000010 040 000 000 000 000 000 000 000 135 013 031 000 000 000 000 000
0000020 001 000 000 000 000 000 001 000 020 000 000 000 000 000 000 000

-c,--one-byte-char一字节字符显示

[root@localhost queue]# hexdump -c id\:000000\,orig\:seed.bin
0000000 355 325 313   m   - 350   D   L 275 241   q 224 031 232 331   *
0000010      \0  \0  \0  \0  \0  \0  \0   ]  \v 031  \0  \0  \0  \0  \0
0000020 001  \0  \0  \0  \0  \0 001  \0 020  \0  \0  \0  \0  \0  \0  \0

-C,--canonical规范十六进制+ ASCII显示

[root@localhost queue]# hexdump -C id\:000000\,orig\:seed.bin
00000000  ed d5 cb 6d 2d e8 44 4c  bd a1 71 94 19 9a d9 2a  |...m-.DL..q....*|
00000010  20 00 00 00 00 00 00 00  5d 0b 19 00 00 00 00 00  | .......].......|
00000020  01 00 00 00 00 00 01 00  10 00 00 00 00 00 00 00  |................|

-n,--length <length>仅解释输入的长度字节

[root@localhost queue]# hexdump -C -n 100 id\:000000\,orig\:seed.bin
00000000  ed d5 cb 6d 2d e8 44 4c  bd a1 71 94 19 9a d9 2a  |...m-.DL..q....*|
00000010  20 00 00 00 00 00 00 00  5d 0b 19 00 00 00 00 00  | .......].......|
00000020  01 00 00 00 00 00 01 00  10 00 00 00 00 00 00 00  |................|
00000030  02 00 00 00 cb e8 d6 a9  04 f1 b5 48 8a a2 62 8f  |...........H..b.|
00000040  cc d6 b8 53 01 00 00 00  05 0b 19 00 00 00 00 00  |...S............|
00000050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000060  ed 0a 00 00                                       |....|
00000064

-d,--two-bytes-decimal两字节十进制显示

-o,-两字节八进制两字节八进制显示
-x,--two-bytes-hex两字节十六进制显示
-L,--color [= <mode>]解释颜色格式说明符
颜色默认启用
-e,--format <format>用于显示数据的格式字符串
-f,--format-file <文件>包含格式字符串的文件
-s,--skip <offset>从开头跳过偏移字节
-v,-不压缩输出相同的行

-h,--help显示此帮助
-V,--version显示版本

posted @ 2020-06-29 22:31  腹肌猿  阅读(1132)  评论(0编辑  收藏  举报