Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use 12.04 Server in command line mode (no X installed), and I would like to change the keyboard layout. How can I do this?

share|improve this question
Mike, would you consider changing the accepted answer? It looks like there is a much better answer now than the originally accepted answer. – Azendale Apr 24 at 18:29
up vote 43 down vote accepted

Please try the following command:

sudo dpkg-reconfigure console-data

If it says you don't have the package, then install console-data with:

sudo apt-get install console-data

More about Locale Configuration: LocaleConf - Community Help Wiki

share|improve this answer
Like that other answer mentions: This does not carry over a reboot. (tested in 12.04.1 LTS) – JonnyJD Aug 1 '13 at 20:11
A hint for people who want to change their keyboard layout during console install: Edit /etc/apt/sources.list and add 'universe' to the listed URL. Otherwise it can't find consol-data – Tobias F. Meier Aug 19 '13 at 17:46

After trying sudo dpkg-reconfigure console-data, I found out that it doesn't work after a reboot.


sudo dpkg-reconfigure keyboard-configuration

does work after reboot and also has more options.

More info here.

share|improve this answer
How do I find out what kind of keyboard I have? It's the Windows 8 Surface pro one. What's the US standard one? – CMCDragonkai Apr 9 '14 at 2:16
This is the correct answer, not the other one. – Clayton Dukes Jun 19 '14 at 15:55


loadkeys es (Spanish, for example)
loadkeys pt (Portuguese, for example)
loadkeys br (Brazilian Portuguese, for example)

share|improve this answer
  • Set US layout: setxkbmap us
  • Set GB layout: setxkbmap gb
share|improve this answer
This commands only works for Ubuntu Desktop, not on Ubuntu Server. – MushRoot Aug 20 '15 at 16:44

Using Ubuntu 13.10 Server as a Virtual Machine in VirtualBox, this worked for me:

(no GUI, only command-line mode)

Default keyboard layout was French, 'AZERTY'

loadkeys us (English, was not 'en' for me, as some docs state)

Note that you will likely have to run the command as sudo loadkeys us.

share|improve this answer
You might want to edit your last line and use sudo instead of root, since root is not the recommended method for commands needing administrator priviledges. – RCF-U16.04 May 9 '15 at 3:34

The correct sollution to make permenant is :

sudo dpkg-reconfigure keyboard-configuration

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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