dumpkeys - Linux


Overview

dumpkeys extracts and prints the mapping between physical keyboard keys and the keysyms and keycodes the kernel will generate. It is used to create keyboard mapping tables.

Syntax

dumpkeys [options] [layout [options]]

Options/Flags

  • -h, --help: Show help and exit.
  • -v, --verbose: Show extra information.
  • -x: Print keysym releases instead of presses.
  • -m, --model: Set model string.
  • -p, --physical: Replace logical keycodes with physical keycodes.
  • -c, --country: Set country code.
  • -f, --file: Specify output file (default: stdout).
  • -i, --include: Specify additional XKB include directives.
  • -j, --joined-lines: Print keymaps in joined lines format.

Examples

Create a keyboard mapping table:

dumpkeys > my_mapping.txt

Print keysym releases instead of presses:

dumpkeys -x

Set model string to "pc105":

dumpkeys -m pc105

Common Issues

  • No output: Ensure your keyboard is properly connected and recognized by the system.
  • Incorrect key mapping: Adjust the layout, model, or country code to match your keyboard.
  • Special keys not working: Some special keys may require additional configuration using tools like xev.

Integration

Combine with xkbcomp: Create a compiled XKB keyboard mapping file:

dumpkeys -m pc105 | xkbcomp my_mapping.xkb

Related Commands

  • xev: Display events generated by the keyboard and mouse.
  • xmodmap: Modify keyboard modifier mappings.
  • XKB documentation