loadkeys

load keyboard translation tables for the console

TLDR

Load keyboard layout
$ sudo loadkeys [en|de|dvorak]
Load default keymap
$ sudo loadkeys --default
Load keymap for specific console
$ sudo loadkeys -C /dev/ttyN [layout]
Load from file
$ sudo loadkeys -C /dev/ttyN [path/to/keymap]
Create binary keymap
$ loadkeys --bkeymap > [output.bmap]
Parse keymap without loading
$ loadkeys --parse [keymap]

SYNOPSIS

loadkeys [options] [keymap...]

DESCRIPTION

loadkeys reads keymap files and loads the keyboard translation tables into the kernel, changing the keyboard layout for virtual consoles.

PARAMETERS

-d, --default

Load default keymap
-C, --console DEVICE
Target specific console device
-m, --mktable
Output kernel source table
-b, --bkeymap
Output binary keymap
-p, --parse
Parse keymap without loading
-q, --quiet
Suppress all normal output
-u, --unicode
Force Unicode mode
-a, --ascii
Force conversion to ASCII
-s, --clearstrings
Clear kernel string table
-c, --clearcompose
Clear kernel accent table
-t, --tkeymap [shape]
Output a text keymap (optional shape: 2, 4, 8, 16)
-V, --version
Display version number and exit

INSTALL

sudo apt install kbd
sudo dnf install kbd
sudo pacman -S kbd
sudo apk add kbd
sudo zypper install kbd
nix profile install nixpkgs#kbd

CAVEATS

Only affects Linux virtual consoles, not X11 or Wayland. Changes apply to all virtual consoles simultaneously and persist until reboot. Anyone with read access to /dev/console can run loadkeys.

SEE ALSO

dumpkeys(1), showkey(1), setxkbmap(1), localectl(1)