How can you change the keyboard layout (to QWERTY from QWERTZ) on the fly from a Linux shell?

I found this similar question, but the answer was to edit a config file, which is not so easy when you're using a Live CD.



  • 1
    I never said I was running X... I am actually, but do you know how to do it from the console? – Hugh Allen Nov 3 '09 at 10:17

kbdconfig or loadkeys

That's how we used to do it. I don't know if they're still supported; I'll check next time I've got Knoppix running.

  • loadkeys works on Arch. Can't use setxdbmap because I don't have X installed. – beatgammit Dec 8 '12 at 17:33

I'm not aware of any tool that changes keymap on-the-fly, but in at least debian it is possible to edit /etc/default/console-setup with your preferred map, and make the system reflect those changes by issuing /etc/init.d/hal restart.


Another option:

Go in the menu and add your layout to keyboard:

System->Preferences->Keyboard, where choose Layouts tab and add your language (the default is the one chosen at installation time). Then you can press the Layout Options... button, and look in Key(s) to change layout for the hot keys that changes the Keyboard layout. For me it is Shift+Caps Lock.

Hope to help.

N.B. I'm running CentOS 6.2 with GNOME interface.

  • I wasn't running Gnome (or KDE either). – Hugh Allen Feb 23 '12 at 8:21

On recent systems, if you have root privileges, you can use the following:

localectl set-keymap en_GB

for the virtual console keyboard, and

localectl set-x11-keymap en_GB

for the X11 layout.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.