How to Get Keyboard Key Names on Linux

Having the name to a certain key on your keyboard comes in handy.

This is especially true for anyone using a tiling window manager.

Since they often use keyboard shortcuts to execute actions.

It may be obvious that the name for the "a" key on your keyboard is "a". But what about "left shift" or "@"?

This is where xev comes in.

  1. Install xev (xorg-xev on arch based systems)
  2. Run xev
  3. Press the desired key

Once you press the key while running xev you'll see a bunch of text pop up in the terminal where you launched xev from.

Look for the line that starts with "state".

On that line is some text inside of parentheses. Something like `keysum 0xffe1, Shift_L'.

The text after the comma is the name of the key on your keyboard.