how to edit binary file on the unix systems

Hemant picture Hemant · May 8, 2009 · Viewed 154k times · Source

On windows machine there are lots of third party editors available to edit a binary file. I belive there should be some thing similer buildin in the *nix systems as well. any idea how can i edit a binary file on unix?

Answer

Paweł Polewicz picture Paweł Polewicz · May 8, 2009

In vim You can type :%!xxd to turn it into a hexeditor. :%!xxd -r to go back to normal mode. xxd is shipped in a vim installation.

See here for some remarks about editing binary files with vim (boils down to :set binary to avoid trouble, use only the "R" or "r" command to change text, don't delete characters).

If You are an Emacs fan, see here for a guide on how to edit a binary file with Emacs.