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.


Displaying available options

  • xxd --help

  • man xxd

1. Converting a file to hex

  • cat vk9-file.txt
  • file vk9-file.txt

2. run xxd

  • xxd vk9-file.txt

3. Skipping lines, skipping the first line

  • xxd -s 0x10 vk9-file.txt

Omit the last line

  • xxd -s -0x10 vk9-file.txt

4. Set a limit length, print 10 bytes

  • xxd -l 0x10 vk9-file.txt

5. Set the number of hex columns to display

  • xxd -c 2 vk9-file.txt

6. Producing binary dump

  • xxd -b vk9-file.txt

7. Reverting from Hex

  • xxd vk9-file.txt > vk9.hex
  • cat vk9.hex
  • xxd -r vk9.hex