showkey command in Linux with Examples

showkey command in Linux is used to examine the codes sent by the keyboard. showkey prints to standard output either the scan codes or the key code or the `ascii’ code of each key pressed. In the first two modes, the program runs until 10 seconds have elapsed since the last key press or release event, or until it receives a suitable signal, like SIGTERM, from another process. In `ascii’ mode the program terminates when the user types ^D.


showkey [-h|--help] [-a|--ascii] [-s|--scancodes] [-k|--keycodes]

Example: This will examine the codes sent by the keyboard.

sudo showkey


  • showkey -h: This option prints to the standard error output its version number, a compile option and a short usage message, then exits.
    sudo showkey -h

  • showkey -s: This option starts showkey in scan code dump mode.
    sudo showkey -s

  • showkey -k: This option starts showkey in keycode dump mode. This is the default when no command line options are present.
    sudo showkey -k

  • showkey -a : This option will start showkey in `ascii‘ dump mode.
    sudo showkey -a

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.