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?
9 Answers
After trying sudo dpkg-reconfigure console-data
, I found out that it doesn't work after a reboot.
However,
sudo dpkg-reconfigure keyboard-configuration
does work after reboot and also has more options.
-
2How do I find out what kind of keyboard I have? It's the Windows 8 Surface pro one. What's the US standard one? Apr 9, 2014 at 2:16
-
26
-
2Older Ubuntu releases, such as Lucid Lynx (10.04), don't have the keyboard-configuration package. Göran's link has the correct answer for these:
sudo dpkg-reconfigure console-setup
If your cursor keys don't work as expected in the ncurses UI, try those on the numeric keypad.– lboOct 9, 2016 at 8:43 -
Worked for me in Ubuntu Server 20.04 with a Raspberry Pi 3B+ For some reason I had to be connected to the internet if I wanted the command to work properly and for the changes to stay active even after rebooting.– NikoJan 1, 2021 at 6:52
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
-
21Like that other answer mentions: This does not carry over a reboot. (tested in 12.04.1 LTS)– JonnyJDAug 1, 2013 at 20:11
-
1A 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 Aug 19, 2013 at 17:46
Try:
loadkeys es
(Spanish)
loadkeys pt
(Portuguese)
loadkeys br
(Brazilian Portuguese)
loadkeys ch
(Swiss German)
-
2doesn't work on my Ubuntu 18.04, keyboard layout in the console remains the same Mar 21, 2019 at 14:42
-
1
-
loadkeys ru
worked for russian, ctrl + shift to toggle between english and russian Apr 10, 2022 at 18:20
For Ubuntu Desktop, you can use:
- Set US layout:
setxkbmap us
- Set GB layout:
setxkbmap gb
-
11
I just had this issue on a console mode only VM.
The solution in my case was editing /etc/default/keyboard
and changing the
XKBLAYOUT="de"
line (a german VM) to
XKBLAYOUT="us"
to work with my US keyboard and then rebooting.
-
I believe this only works with a GUI. Also - the reboot is not really required, you can also set the variable in the current terminal by simply overwriting it.
XKBLAYOUT="us"
– SaAtomicJun 9, 2017 at 8:28 -
1
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
.
-
You might want to edit your last line and use
sudo
instead ofroot
, since root is not the recommended method for commands needing administrator priviledges.– RCFMay 9, 2015 at 3:34 -
2I could not get
loadkeys us
to work, even withsudo
. It was saying that the file "us" couldn't be found. This on my Raspberry Pi.– jocullSep 25, 2016 at 17:48
I succeeded today configuring this on my Raspberry Pi 3 via:
- generating the required locale
locale-gen de_DE.UTF-8
- calling
loadkeys de
so many potential solutions, but here is what helped me in the end:
sudo dpkg-reconfigure locales
if it failes with something like locales not found
, install the package locales
and rerun the above command.