How do I change keyboards from the command line?
Solution 1:
You can find all the different keymaps in the following locations:
/usr/share/keymaps/i386/
/usr/share/kbd/keymaps/i386/
/usr/share/X11/xkb/symbols/
To change the keyboard layout (e.g. to Spanish) in the Linux command line, type the following command:
loadkeys es
For X:
setxkbmap es
To make these changes system wide, assuming you’re using Ubuntu, you can use the following:
sudo dpkg-reconfigure console-setup
Solution 2:
From terminal
English to Hebrew and vise versa with Alt + Shift
setxkbmap -option grp:alt_shift_toggle us,il
You can see all locale alias with this command
cat /etc/locale.alias
More info about setxkbmap in manual
man setxkbmap
Solution 3:
Ubuntu 13.10 or Later
This works better then setxkbmap with Gnome/Unity keyboard layout indicator.
gsettings set org.gnome.desktop.input-sources current 0
0 is the layout index (0 default or top layout). Layouts indexed starting from 0.
For easy use, create an alias.