Changing TTY keyboard layout on a server?
346,196
Solution 1
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
Solution 2
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.
Solution 3
Try:
loadkeys es
(Spanish)
loadkeys pt
(Portuguese)
loadkeys br
(Brazilian Portuguese)
loadkeys ch
(Swiss German)
Solution 4
- Set US layout:
setxkbmap us
- Set GB layout:
setxkbmap gb
Solution 5
For me this did it
localectl set-keymap de-latin1
Author by
Mike
Updated on September 18, 2022Comments
-
Mike over 1 year
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?
-
Dan Hibbert about 8 yearsMike, would you consider changing the accepted answer? It looks like there is a much better answer now than the originally accepted answer.
-
-
JonnyJD almost 11 yearsLike that other answer mentions: This does not carry over a reboot. (tested in 12.04.1 LTS)
-
Tobias F. Meier almost 11 yearsA 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
-
CMCDragonkai about 10 yearsHow do I find out what kind of keyboard I have? It's the Windows 8 Surface pro one. What's the US standard one?
-
Clayton Dukes almost 10 yearsThis is the correct answer, not the other one.
-
RCF about 9 yearsYou might want to edit your last line and use
sudo
instead ofroot
, since root is not the recommended method for commands needing administrator priviledges. -
blkpws almost 9 yearsThis commands only works for Ubuntu Desktop, not on Ubuntu Server.
-
jocull over 7 yearsI 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. -
lbo over 7 yearsOlder 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. -
SaAtomic almost 7 yearsI 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"
-
Andrea Turbiglio about 5 yearsdoesn't work on my Ubuntu 18.04, keyboard layout in the console remains the same
-
RoBeaToZ over 4 years
loadkeys de
for german keyboard layout worked for me, thx! -
Niko over 3 yearsWorked 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.
-
ATorras over 2 yearsIt also works on Ubuntu 20 (focal)
-
user3804598 about 2 years
loadkeys ru
worked for russian, ctrl + shift to toggle between english and russian