Cor*_*ein 34 bsd utilities hexdump
在我的机器上,当我运行这些命令时,我得到以下输出:
$ echo foos > myfile
$ hexdump myfile
6f66 736f 000a
Run Code Online (Sandbox Code Playgroud)
hexdump 的输出是小端的。这是否意味着我的机器是小端格式,还是 hexdump 总是使用小端格式?
Gil*_*il' 47
传统的 BSDhexdump
实用程序使用平台的字节序,因此您看到的输出意味着您的机器是小字节序的。
使用hexdump -C
(或od -t x1
) 获得一致的逐字节输出,而不管平台的字节序如何。
从联机帮助页:
-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.
Run Code Online (Sandbox Code Playgroud)
...
If no format strings are specified, the default display is equivalent to
specifying the -x option.
Run Code Online (Sandbox Code Playgroud)
您的输出是 little-endian(最低有效字节在前),这也是您可能正在使用的 x86 和 x86_64 架构的字节序。
归档时间: |
|
查看次数: |
31061 次 |
最近记录: |