Open In App

showkey command in Linux with Examples

Improve
Improve
Like Article
Like
Save
Share
Report

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.

Syntax:

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

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

sudo showkey

Options:

  • 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


Last Updated : 27 May, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads