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?
To change the system-wide keyboard layout, run
sudo dpkg-reconfigure keyboard-configuration
or edit the
XKBLAYOUT line in
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:
To do this automatically every time, extend your
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.
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
loadkeys us ----it loads US keys but for a single session.
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.
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.