Using Vim to Display a File in Hex

  1. Run hexdump -C <filename> > output.txt to open the file and save it onto a file called output.txt. You can then open this output.txt file separately and view it.
  2. Open the file in Vim directly as hexadecimal.
➜ cat hello_world.txt
Hello World!
➜ hexdump -C hello_world.txt
00000000 48 65 6c 6c 6f 20 57 6f 72 6c 64 21 0a |Hello World!.|
0000000d
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!\n";
return 0;
}
➜ g++ hello_world.cpp -o hello_world
➜ ./hello_world
Hello World!
Output of the hello_world executable/binary file
Front of hello_world executable/binary file in hexadecimal
End of hello_world executable/binary file in hexadecimal
hexdump -C hello_world

Hacker. Aspiring tech entrepreneur. Passionate about technological advancements for the betterment of humanity. https://zhenghaotan.com

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Zheng Hao Tan

Zheng Hao Tan

Hacker. Aspiring tech entrepreneur. Passionate about technological advancements for the betterment of humanity. https://zhenghaotan.com

More from Medium

Easily Toggle Philips Hue Depending on Your PC State v2

Docker and Python debugging error in VS Code: Timed out waiting for launcher to connect.

Automatic login script for your Bastion Host

Rsync from macOS to Linux Server