xxd 工具

xxd 命令对于标准输入或者给定的文件,显示其16进制的内容。也可以反过来进行转换。

命令用法

$ xxd [options] [infile [outfile]]

其中,

  • infile 表示要输入进行 16 进制编码的文件

  • outfile 表示转换结果的输出文件

常用可选参数

使用实例

  1. 显示十六进制格式

     gackle@machine:~$ echo 1111111 > 1.txt
    
     gackle@machine:~$ cat 1.txt
     1111111
    
     gackle@machine:~$ xxd 1.txt
     00000000: 3131 3131 3131 310a                      1111111.
  2. 转换为二进制形式显示

     gackle@machine:~$ xxd 1.txt |xxd -r
     1111111

Last updated