47
16
I need to change layout of keyboard while working in console in Linux. I need to setup English layout as default for console. How to do it?
47
16
I need to change layout of keyboard while working in console in Linux. I need to setup English layout as default for console. How to do it?
46
To change the system-wide keyboard layout, run
sudo dpkg-reconfigure keyboard-configuration
or edit the XKBLAYOUT
line in /etc/default/keyboard
.
2
On Red Hat 7: localectl status
, localectl list-keymaps
,localectl set-keymap cz
, see Changing the Keyboard Layout ... The keymaps are in /usr/lib/kbd/keymaps/
btw..
Hi)) Ubuntu 18.04.2 with the Gnome desktop does not respond to the state /etc/default/keyboard
. To change the keyboard settings in this case, you need to use dconf
– AtachiShadow – 2019-02-18T19:58:57.757
16
To change your keyboard layout fast, just install setxkbmap with:
sudo apt-get install x11-xkb-utils
After this you can always change the keyboard layout with:
setxkbmap us
To do this automatically every time, extend your .bashrc
with:
echo "setxkbmap us" >> ~/.bashrc
Now, open a new console and the US keyboard layout is activated. Don't worry if the small keyboard layout icon in the Ubuntu panel does not change.
This does not really change the default keyboard layout but is a sort of hack to reset the keyboard layout to another one everytime you open a new console (while it is only necessary to reset after reboot). For a permanent solution, it is possible to set it directly, for example in /etc/default/keyboard
like suggested by other answers. – baptx – 2018-08-16T15:27:51.737
This doesn’t answer the question. setxkbmap(1) works under X (graphical) while OP asked about the console. OP even brought up loadkeys(1) in a comment on his question, three years before you posted this answer (loadkeys(1) is a console-only program).
– Guildenstern – 2019-10-26T19:17:46.7908
another way, but I understand it wont last for next boot:
sudo loadkeys /usr/share/keymaps/i386/qwerty/us.kmap.gz
check /usr/share/keymaps/i386/ for you keyboard layout and keymaps to what suits you better
Put it in /etc/profile.d/bashrc – B K – 2012-03-25T01:01:27.423
@BK, may be at /etc/rc.local
to not require sudo? – Aquarius Power – 2017-12-26T18:48:18.853
1
loadkeys us ----it loads US keys but for a single session.
Loadkeys has alrwsyd been suggested, and in better answers which included information on HOW to use it. Please avoid posting duplicate information in answers, especially when your posts does not actually consist of a complete answer. – music2myear – 2019-09-22T15:48:44.103
Best answer for me though. – not2savvy – 2019-09-23T12:14:25.680
0
the very funny could be to switch back.. possible solution is, to make bash script (named w/ symbols of target language. for instance, англ). 2nd trick is, to type "setxkbmap us; setxkbmap ru" then it's possible to use bash history to return main layout to console.
1Can you please clarify (1) what you’re saying, and (2) how it answers the question? – Scott – 2018-03-06T20:29:50.973
well, you switched console in russian language. how would you like to switch it back to english 777 actually, i didn't answer main question, i just added some tricks to avoid possible problems. For example, you work w/o gui & switched console to russian, so you cannot type any command. :) – Z0dCHiY8 – 2018-03-06T22:06:06.603
-1
A better hack is to monitor udev and reset it automatically if the keyboard gets disconnected. Even users on laptops might need it, since it might get instantaneously disconnected. I just made a github repo to do this.
What distro are you using? – emzero – 2012-03-24T23:31:38.470
Ubuntu, logged under root – J.Olufsen – 2012-03-24T23:37:06.267
1"loadkeys us" worked! How to make it default layout? – J.Olufsen – 2012-03-24T23:42:44.527