On a graphical desktop manager
If you are running an xserver, as in if you are using a graphical desktop manager like gnome, kde, xfce, awesome, xmonad, i3wm or whatever else, enter the following. On ubuntu, setxkbmap is included in the package “x11-xkb-utils”.
setxkbmap -layout de # for german layout setxkbmap -layout us # for us layout
In a terminal
If you only use a text terminal (crtl alt F1-6 in debian / ubuntu) you can use:
loadkeys us loadkeys de
The keyboard settings are stored in /etc/default/keyboard file. You can reconfigure the keyboard layout compfortly and with all the options you saw during the installation of your (debian based) linux distribution via:
For the initramfs you can insert the KEYMAP=y option in /etc/initramfs-tools/initramfs.conf. To apply the changes rebuild your initramfs via: