Skip to main content

TIL: Using xxd To View Key Hex Code

The best way to predict the future is to create it.
— Anonymous.

In this today I learned, how to view key hex code. As I modify my iTerm2 key shortcuts to map my tmux Ctrl + b keys, I wonder how to get easily key hex codes.

Then I remember the xxd command can process keys and convert them to hex code.

To start off run xxd from the terminal. It will wait for a read line. Execute your keystrokes (e.g. C-b) then press enter to create a new line. After the new line add EOF which would be Ctrl + d. Then that would output a hex key code that you desire.1

Another trick is to reverse hex using xxd command like this.

echo <hex code> | xxd -revert -plain | rev | tr -d '\n' | xxd -plain

An example hex code would be 030201. That would output a reverse 010203. The rev command will reverse the output while the tr would trim newline.


  1. https://stackoverflow.com/questions/36321230/finding-the-hex-code-sequence-for-a-key-combination ↩︎

Popular posts from this blog

Disable mDNS and SSDP Discovery in Google Chrome

We're born alone, we live alone, we die alone. Only through our love and friendship can we create the illusion for the moment that we're not alone. — Orson Welles.

Flutter Series: Custom Icons

Everyone thinks of changing the world, but no one thinks of changing himself. — Leo Tolstoy. Custom Free Icons For Everyone! As I began learning Flutter, to develop new apps. I began to wonder, how can I beautify it to almost match the wireframe I’m copying. There are several things to consider, getting exact dimensions and well crafted image and icons. For today’s how-to article, we will get deeper on how to add custom icons to flutter development environment as well use it in app.

Editor Series: Configuring Emacs To Fit The Needs Part 2

The world as we have created it is a process of our thinking. It cannot be changed without changing our thinking. — Albert Einstein. As the title says, to fit the needs. Currently, I’m looking into handling multiple projects but vast differ in programming paradigm ang language. Some of the language that I’ll probably tackling are Go, Rust, Ruby, Perl, C++, Javascript, Typescript, and etc.

Let's Explore!

Let’s find some beautiful place and get lost. — Self Thoughts.