DEV Community

Arbaoui Mehdi
Arbaoui Mehdi

Posted on

How to use the Editor Vim as an Hex Editor

I want to display the hexadecimal 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; } 
Enter fullscreen mode Exit fullscreen mode

So after you generate the binary helloworld using the gcc compiler:

 gcc helloworld.c -o helloworld 
Enter fullscreen mode Exit fullscreen mode

You’ve to edit the executable using vim:

 vim helloworld 
Enter fullscreen mode Exit fullscreen mode

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

Alt Text

Top comments (0)