分页: 1 / 1

hexdump,hd,vi,这三个显示同一文件时字节内容各不相同?

发表于 : 2014-05-08 20:30
科学之子
hexdump,hd,vi,这三个显示同一文件时字节内容各不相同?
左边是:hexdump test|less, 中键是:hd test |less ,右边是:vi test.
注:vi用的是:%!xxd命令
hex查看.png
(8.15 KiB) 已下载 3 次

Re: hexdump,hd,vi,这三个显示同一文件时字节内容各不相同?

发表于 : 2014-05-08 20:45
astolia
一样的啊

代码: 全选

man hexdump
If no format strings are specified, the default display is equivalent to
specifying the -x option.
-x Two-byte hexadecimal display. Display the input offset in hexa‐
decimal, followed by eight, space separated, four column, zero-
filled, two-byte quantities
of input data, in hexadecimal, per
line.
-C Canonical hex+ASCII display. Display the input offset in hexa‐
decimal, followed by sixteen space-separated, two column, hexa‐
decimal bytes, followed by the same sixteen bytes in %_p format
enclosed in ``|'' characters.

Calling the command hd implies this option.
vi会保证文件以空行结尾,所以后面加了个换行

Re: hexdump,hd,vi,这三个显示同一文件时字节内容各不相同?

发表于 : 2014-05-08 21:01
astolia
hexdump和hd的默认显示风格就等同于
od -t x2 和 od -t x1

这两个本来就是同一个东西

代码: 全选

$ ls -l /usr/bin/hd 
lrwxrwxrwx 1 root root 7 Jun  4  2013 /usr/bin/hd -> hexdump