LinuxCommandLibrary

kbdinfo

Display keyboard information

SYNOPSIS

kbdinfo [options] [variable...]

PARAMETERS

--short-info, -s
    Suppresses the 'variable=value' prefix, printing only the raw value of the queried information.

--help, -h
    Displays usage information for the command and then exits.

--version, -V
    Prints the version information of the kbdinfo utility and then exits.

DESCRIPTION

The kbdinfo command is a utility designed to retrieve and display information about the current state of the Linux console and keyboard. It provides insights into various aspects, ranging from keyboard modes and LED states to console screen dimensions and cursor properties. When invoked without any specific arguments, kbdinfo outputs a comprehensive list of all available information, typically presented in a "variable=value" format, which makes it easy to parse for scripting or analysis. Users can also specify particular variables as arguments to query only the information they need, such as the current keyboard mode (kmode), the state of the Scroll Lock, Num Lock, and Caps Lock LEDs (leds), or the virtual console number (console-vc-number). This command is particularly useful for system administrators, developers, and users who need to diagnose keyboard or console-related issues, monitor system settings, or integrate console state checks into automated scripts. It provides a programmatic way to inspect the underlying console and keyboard configuration without relying on interactive tools.

CAVEATS

When using the setterm -term linux command, the console cursor type might be reset to default, potentially affecting the accuracy of the console-cursor-type information reported by kbdinfo.

QUERYABLE VARIABLES

kbdinfo can query various aspects of the keyboard and console. If no specific variables are provided, it prints all known information. Common categories of variables include:
Keyboard Mode and State: kmode (keyboard mode), leds (LED status: SCR, NUM, CAP), shift-state (active modifiers like SHIFT, CTRL, ALT).
Bell Settings: bell-pitch, bell-duration, bell-state.
Console Screen Information: console-screen-size (columns and rows), console-cursor-position, console-font-range.
Device Information: kbd-device (keyboard input device), console-device (console output device).
Keymap Details: keymap-name, keymap-path, current-kb-table.
Input Event Details: last-keypress-time, last-keypress-keycode.
Compose and Dead Key State: compose-state, dead-state.
The special variable all queries all known information.

SEE ALSO

dumpkeys(1), loadkeys(1), setfont(8), consolechars(8)

Copied to clipboard