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.
- 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