vim 十六进制编辑器

vim 用作十六进制编辑器

使用 vim -b file_name 可以以二进制格式打开文件。

在 Linux 下,使用 xxd 命令可以做 16 进制 和 2 进制之间的转换。

xxd creates a hex dump of a given file or standard input. It can also convert a hex dump back to its original binary form. Like uuencode(1) and uudecode(1) it allows the transmission of binary data in a ‘mail-safe’ ASCII representation, but has the advantage of decoding to standard output. Moreover, it can be used to perform binary file patching.

因此,vim + xxd 就可以成为 Linux 下的一个 16 进制的编辑器。

使用方法:

  • 使用 vim -b file 二进制模式打开文件,
  • 执行命令 :%!xxd,将缓冲区内容使用 xxd 工具转换为 16 进制,
  • 可以使用 :%!xxd -r 转换回来。
updatedupdated2022-05-272022-05-27