How to use VIM as an Hex Editor

I want to display the hex format of a compiled binary from an helloworld.c program using vim.

The source code of the helloworld.c:

#include < stdio.h >
int main()
   // printf() displays the string inside quotation
   printf("Hello, World!");
   return 0;

So after you generate the binary helloworld using gcc:

gcc helloworld.c -o helloworld

You’ve to edit the executable using vim:

vim helloworld

The last step is to use the xxd command to transform the result to the hex presentation by doing :%!xxd.

Leave a Reply

Your email address will not be published. Required fields are marked *