Ubuntu 18.04 comes with many keyboard layouts that you can choose from depending on the Language and region. In this short tutorial, I am going to show you how you can configure keyboard in Ubuntu 18.04 on terminal.
Keyboard Layout is based on the following parameters XKB parameters, found in
- XkbModel - This parameter defines the XKB model name. The default is pc105
- XkbLayout - This attribute specifies the XKB keyboard model name, more specifically the Country & Language type of the keyboard. The default language is us.
- XkbVariant - This defines the variant components of XKB keyboard. These are used in further specifying the layout details.
- XkbOptions - This specifies the keyboard's extra functionalities or options such as the behavior of special keys e.g SHIFT, CTRL, ALT, ESC etc.
For more information on this run visit the keyboard man pages
Temporarily Configure keyboard in Ubuntu
If you wish to configure the keyboard for the current session only, run
This opens a screen with a list of possible keyboard layouts as shown below.
Next, you'll be required to select the Language and Country
Select Matching keyboard
The changes made will not survive a reboot.
Permanently Configure keyboard in Ubuntu
If you want to permanently configure your keyboard settings, edit the keyboard file with your preferred text editor
locate XKBLAYOUT= parameter and change it to your own preference e.g
This changes it to the French Language. Feel free to make changes to other parameters as well.
Save and Exit.
Permanently configure keyboard in one line on the terminal
You can configure the keyboard Language in one line. For instance, to set it to French, run
L='fr' && sudo sed -i 's/XKBLAYOUT=\"\w*"/XKBLAYOUT=\"'$L'\"/g' /etc/default/keyboard
For US English, execute
L='us' && sudo sed -i 's/XKBLAYOUT=\"\w*"/XKBLAYOUT=\"'$L'\"/g' /etc/default/keyboard
The above survives a reboot and the settings are sustained.
Configuring Keyboard Language and Layout in GUI
Another way of configuring the Keyboard in Ubuntu 18.04 is going the graphical way. Upon logging in, head
out to the taskbar and locate the keyboard language icon. when clicked on, a pull-down menu will display a list of default languages and the active Language as shown. In the example shown below, English(US) is set as the default Language.
When you click on 'Show Keyboard Layout' a graphical representation of the keyboard's layout that correspond's to the Language set will be displayed.
To add another Language, click on the down arrow, next to the battery a and select the 'Settings' icon as shown.
In the next window, click on 'Region and Language'. Below the 'Input Sources' section, click the + symbol to add a new language.
A list will be populated as shown.
To add other Language options, scroll to the bottom and click on 'Other'.
Select your preferred language and hit on the Add button.
when you go back to Region and Languages, under Input sources, you'll find your newly added keyboard language.
To make it the default language, Head out to the taskbar language settings icon, click on it and select the language added.
In this tutorial, we have outlined the steps you need to take to configure keyboard on Ubuntu. Feel free to try the steps out. Your feedback will be welcome.