Use vi as a hexadecimal editor

A quick little post, a sort of reminder for me, but it may be useful to others…

You can use vi (or vim) as a hexadecimal editor. You just have to press “Echap”, then enter the following command

:%!xxd

The text is translated in hexadecimal. Be careful : if you save the document, you save its hexadecimal form (not very serious : you can translate it back). In fact, Vi translates your “normal” text in hexadecimal characters, but after that, it uses them as a “normal” text.

In order to translate a hexadecimal text in a “normal” text, it’s the following command :

:%!xxd -r

Easy! =)

Comments are closed.