Hex editor of binary files on Linux


Reading this thread on Stackoverflow http://stackoverflow.com/questions/5498197/need-a-good-hex-editor-for-linux I wondered how come with so many hex editors in Linux there is not really the best one. In Windows it is easier - the expensive WinHex or the affordable Hiew. Anyway, as to the Linux I always use Vim:
Entering %!xxd to switch to Hex editing mode,setting :set binary and after finishing the edit issuing %!xxd -r back to binary to be able to save the edited file. Do not save in the Hex editing mode - the file will be saved as ASCII hex representation file, always revert back to binary.

In steps:
1. Open a file in Vim as usual.
2. Switch from binary representation :%!xxd using external xxd tool.
3. Set mode to binary :set binary so Vim does NOT automatically add linefeed (0xA) on saving.
4. Do the edits (edit hex values, ignore ASCII column and line numbers).
5. Switch back :%xxd -r to convert hexdump back into binary.
6. Write the changes back to file and quit wq.

Note: If the righthand ASCII column and line numbers which are not part of the binary distract, you can display the file contents without them using :%!xxd -p and :%!xxd -r -p.

For the list of available Hex editors, see WIkipedia: Comparison of hex editors.

Follow me on https://www.linkedin.com/in/yurislobodyanyuk/ not to miss what I publish on Linkedin, Github, blog, and more.