Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to play around with some keyboard layouts in ubuntu. Now there is a program called showkey which lets me see the keycode for any key pressed in the terminal. Is there any command to get the corresponding character for a specific keycode. For example when i type in

sudo showkey
//I get the response in the form
keycode num press/release

I was just wondering if i have the keycode, can I get the character mapping back so that i know which character I actually pressed?

share|improve this question
up vote 14 down vote accepted

Run xev from a terminal. This will give you a new window.

Place your mouse pointer in this window, type some keys and watch for results in the terminal.

share|improve this answer

In order to get a terminal print-out of all key codes and corresponding keys, run the following command in a terminal:

xmodmap -pk

It's not easy to view in a (small) terminal window, so if you want to save the output to a file, just add the command to let the terminal output be saved in a file (in your current working directory in the terminal):

xmodmap -pk > mykeyboard.txt

Full description of how to use xmodmap here.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.