LinuxCommandLibrary

showkey

Display keyboard keycodes and scancodes

TLDR

View keycodes in decimal

$ sudo showkey
copy
Display scancodes in hexadecimal
$ sudo showkey -s
copy
Display keycodes in decimal
$ sudo showkey -k
copy
Display keycodes in ASCII, decimal, and hexadecimal
$ sudo showkey -a
copy

SYNOPSIS

showkey [options]

DESCRIPTION

showkey displays the keycode of pressed keys on the keyboard. This is useful for debugging keyboard-related issues, key remapping, and understanding keyboard input at a low level.
The program runs until 10 seconds pass without any key press, or until Ctrl+D is pressed (in ASCII mode).

PARAMETERS

-s, --scancodes

Display scancodes in hexadecimal
-k, --keycodes
Display keycodes in decimal (default)
-a, --ascii
Display keycodes in ASCII, decimal, and hexadecimal
-h, --help
Display help message

CAVEATS

Must be run as root or with sudo. Only works on the Linux console, not in terminal emulators under X11 or Wayland. The keyboard becomes unusable for normal input while running.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community