showkey — 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. It can be used to check the keyboard driver and key mappings.
$ showkey — Show the interpreted keycode.
$ showkey -k — Same as above (Default Option).
$ showkey -s — Show the raw scan-codes of the keys.
$ showkey -a — Show the Decimal/Octal/Hex values of the keys.
If Showkey is in keycode/scancode mode, then you have to wait 10 second to exit. In ASCII mode, Press Ctrl+D to exit.
Read: man showkey