How to Configure Keyboard on Ubuntu 18.04

Ubuntu 18.04 comes with many keyboard layouts that you can choose from depending on the Language and region. In this short article, we are going to show you how you can configure keyboard in Ubuntu 18.04on terminal.

Keyboard Layout is based on the following parameters XKB parameters,  found in /etc/default/keyboard file

  • 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.

 configure keyboard in Ubuntu

For more information on this run visit the keyboard man pages

man keyboard

Sample Output

 configure keyboard in Ubuntu

Temporarily Configure keyboard in Ubuntu

If you wish to configure the keyboard for the current session only, run

dpkg-reconfigure keyboard-configuration

This opens a screen with a list of possible keyboard layouts as shown below.

configure keyboard in ubuntu

Next, you'll be required to select the Language and Country

configure keyboard in Ubuntu

Select Matching keyboard

configure keyboard in Ubuntu
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

nano /etc/default/keyboard

locate XKBLAYOUT= parameter and change it to your own preference e.g

XKBLAYOUT= 'fr'

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.

configure keyboard on ubuntu

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.

configure keyboard on ubuntu

To add another Language, click on the down arrow, next to the battery a and select the 'Settings'icon as shown.

configure keyboard on ubuntu

In the next window, click on 'Region and Language'. Below the 'Input Sources' section, click the + symbol to add a new language.

configure keyboard on ubuntu

A list will be populated as shown.

configure keyboard on ubuntu

To add other Language options, scroll to the bottom and click on 'Other'.

configure keyboard on ubuntu

Select your preferred language and hit on the  Add button.

configure keyboard on ubuntu

when you go back to Region and Languages, under Input sources, you'll find your newly added keyboard language.

configure keyboard on ubuntu

To make it the default language, Head out to the taskbar language settings icon, click on it and select the language added.

configure keyboard on ubuntu

In this article, 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.

Jamie Arthur 12:05 am

About Jamie Arthur

Hey, I'm James, a passionate Linux Systems administrator, and a tech enthusiast. I derive immense gratification in conducting research on Linux systems and keeping myself up to date with the latest in the technology world.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.