IT lexicon › Infra & Ops › xmodmap

xmodmap

Infra & Ops På svenska → Updated: 2026-10-07

The command-line tool that edits the X server's keycode-to-symbol table, and with it what each key actually does.

The core X11 protocol keeps a simple table mapping each keycode to one or more keysyms, plus a list of which keys act as modifiers. xmodmap reads and writes that table. The classics are turning Caps Lock into Control via a ~/.Xmodmap file, or swapping mouse buttons with pointer = 3 2 1 for left-handers. xev was what you ran first to find out the keycodes.

Since XKB took over, xmodmap is one layer sitting on top of another system. Its changes silently disappear whenever the layout is switched or a new keyboard is plugged in, which has led generations of Linux users to paste the command into ever more startup scripts. Under Wayland it does nothing at all.

← Back to the lexicon