NAME
hexdump - ascii, decimal, hexadecimal, octal dump
SYNOPSIS
[-bcCdovx] [-e format_string] [-f format_file] [-n length] [-s skip] file ...
DESCRIPTION
The hexdump utility is a filter which displays the specified files, or the standard input, if no files are specified, in a user specified format.
--------------------------------------------------------------------------------
参数及含义:
-s offset 从偏移量开始输出
-n length 只格式化输入文件的前length个字节
-v 显示所有的重复数据
-C 输出十六进制和对应字符
-e 指定格式字符串,格式字符串包含在一对单引号中
基本用法:
hexdump xxx
例子:
$ echo 'Hello, world!' > hello.txt
$ cat hello.txt
Hello, world!
$ hexdump hello.txt
0000000 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 0a
000000e
$ hexdump -C hello.txt
00000000 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 0a |Hello, world!.|
0000000e
$ hexdump -s 0x7 -n 5 -v -C hello.txt
00000007 77 6f 72 6c 64 |world|
0000000c
$ hexdump -s 0x7 -n 5 -v -e '16/1 "%02X " "\n"' hello.txt
hexdump - ascii, decimal, hexadecimal, octal dump
SYNOPSIS
[-bcCdovx] [-e format_string] [-f format_file] [-n length] [-s skip] file ...
DESCRIPTION
The hexdump utility is a filter which displays the specified files, or the standard input, if no files are specified, in a user specified format.
--------------------------------------------------------------------------------
参数及含义:
-s offset 从偏移量开始输出
-n length 只格式化输入文件的前length个字节
-v 显示所有的重复数据
-C 输出十六进制和对应字符
-e 指定格式字符串,格式字符串包含在一对单引号中
基本用法:
hexdump xxx
例子:
$ echo 'Hello, world!' > hello.txt
$ cat hello.txt
Hello, world!
$ hexdump hello.txt
0000000 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 0a
000000e
$ hexdump -C hello.txt
00000000 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 0a |Hello, world!.|
0000000e
$ hexdump -s 0x7 -n 5 -v -C hello.txt
00000007 77 6f 72 6c 64 |world|
0000000c
$ hexdump -s 0x7 -n 5 -v -e '16/1 "%02X " "\n"' hello.txt
77 6F 72 6C 64
参考资料:
1. hexdump命令使用