Linux "showkey" Command Line Options and Examples
examine the codes sent by the keyboard

showkey prints to standard output either the scan codes or the keycode 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.


Usage:

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






Command Line Options:

-h
showkey prints to the standard error output its version number, a compile option and a short usage mes‐sage, then exits.
showkey -h ...
-s
Starts showkey in scan code dump mode.
showkey -s ...
-k
Starts showkey in keycode dump mode. This is the default, when no command line options are present.
showkey -k ...
-a
Starts showkey in `ascii' dump mode.
showkey -a ...
-V
showkey prints version number and exits.2.6 KERNELSIn 2.6 kernels key codes lie in the range 1-255, instead of 1-127. Key codes larger than 127 are returned asthree bytes of which the low order 7 bits are: zero, bits 13-7, and bits 6-0 of the key code. The high orderbits are: 0/1 for make/break, 1, 1.In 2.6 kernels raw mode, or scancode mode, is not very raw at all. Scan codes are first translated to keycodes, and when scancodes are desired, the key codes are translated back. Various transformations areinvolved, and there is no guarantee at all that the final result corresponds to what the keyboard hardware didsend. So, if you want to know the scan codes sent by various keys it is better to boot a 2.4 kernel. Since2.6.9 there also is the boot option atkbd.softraw=0 that tells the 2.6 kernel to return the actual scan codes.
showkey -V ...