Learn how to Change the Keyboard Format on Raspberry Pi

Don't like the standard keyboard layout on Raspberry Pi? Here are three ways to change the keyboard layout settings on your Raspberry Pi.

Raspberry Pi is a popular single board computer that people of all ages can use to get introduced to computers. It features a wide range of models, each with their own specifications and capabilities, making it suitable for numerous applications.

Regardless of how you want to use your Raspberry Pi, the hardware needs an operating system before programs can run. Fortunately, the Raspberry Pi Foundation officially provides the Raspberry Pi OS (formerly Raspbian), which runs on all Raspberry Pi models.

Why should you change your keyboard layout?

When you install Raspberry Pi OS on your Raspberry Pi for the first time, the keyboard is set to QWERTY – English (UK), which reflects the origins of Raspberry Pi.

However, since not everyone prefers the QWERTY layout and not all regions have the same special character keys on their keyboards as the English (UK) keyboard, using the default keyboard setting can be annoying and / or challenging. Hence, it is best to change the Raspberry Pi's keyboard layout before you start working.

How to change keyboard layouts on Raspberry Pi OS

Since Raspberry Pi OS is available in three different versions – Raspberry Pi OS with desktop and recommended software, Raspberry Pi OS with desktop, and Raspberry Pi OS Lite – the approach to changing the keyboard layout for each of these programs depends on the built-in programs.

Related: The Raspberry Pi Board Guide: Zero Versus Model A and B.

Of the three Raspberry Pi OS versions, the first two offer a desktop environment with which keyboard layouts can be easily changed. The Lite version lacks a desktop environment, so you'll need to use a non-GUI method to change the keyboard layout.

There are a total of three ways to change the standard keyboard layout on a Raspberry Pi with Raspberry Pi OS. We're going to go through each step to walk you through each one.

1. Using Raspberry Pi Desktop

For a full-fledged (even headless) Raspberry Pi OS installation on your Raspberry Pi, using the desktop environment is the easiest way to change the keyboard layout.

So if you have either the "Raspberry Pi OS with desktop" or "Raspberry Pi OS with desktop and recommended software" version installed on your Raspberry Pi, you should opt for this method.

  1. With the Raspberry Pi running, click the Raspberry Pi icon in the top left corner of the screen.

  2. Select the option from the drop-down menu Settings > Mouse and keyboard settings. In the Mouse and Keyboard Settings dialog box, select keyboard Tab. On the next screen, click Keyboard layout Button.

  3. Alternatively, if the Mouse and Keyboard Settings option is not available in the Settings menu, you can select Raspberry Pi configuration. And then go to the Raspberry Pi configuration window Localization Tab and click Set the keyboard.

  4. Now you have three different settings. To change them, click the drop-down button next to each one.

    • model: Defines the keyboard model to be used. should be set to Generic 105-key PC (intl) – unless you are using a special keyboard.
    • layout: Defines the keyboard layout based on the region. should be set to the default keyboard layout for your country.
    • variant: Defines the type of layout your keyboard uses. should be set to US English – unless you are using other keyboard formats such as DVORAK.
  5. click OK.

2. Using the Raspi-Config-Tool

If "Raspberry Pi OS Lite" is installed on your Raspberry Pi, it does not have a desktop (graphical interface) through which you can interact with the system. In this case, the best way to change the keyboard layout is to use the raspi-config tool.

To do this, connect your Raspberry Pi directly to a monitor or SSH from another device. In the raspi-config window, use the arrow keys to navigate through the menu and the enter key to select items.

  1. Enter on the command line sudo raspi-config. If it's your first start, this screen should appear automatically.

  2. Navigate to the configuration menu and select Location options.

  3. Select on the next screen Change the keyboard layout.

  4. Make sure the default keyboard layout is the generic 105 key (intl.) PC. Select an option from the list for the keyboard layout. (In general, US English works best for most people.) Unless you're using a different variant, select QWERTY from the variant picker.

  5. From here on, you can keep the default configurations for the rest of the keyboard settings.

  6. Choose Finished to save your changes and exit.

3. Using the keyboard configuration file

While the above two methods will work fine in most cases, at times when it doesn't, you can edit the configuration file to change the keyboard configuration. If you are using "Raspberry Pi OS Lite" on your Raspberry Pi and the raspi-config tool method doesn't work for some reason, you can use this method to change your keyboard layout.

Related: Set up VNC on Raspberry Pi so that it can be controlled remotely from any PC or phone

To do this, first connect your Raspberry Pi to a monitor or log in from another computer via SSH. Then follow the steps below.

  1. Enter the following command on the command line to open the keyboard configuration file: sudo nano / etc / default / keyboard.

  2. On the edit page, edit the value for XKBLAYOUT and set it to "us" for English (US). The configuration file should look something like this:
    XKBMODEL = "pc105"
    XKBLAYOUT = "we"
    XKBVARIANT = ""
    XKBOPTIONS = ""
    BACKSPACE = "rate"

  3. Beat CTRL + S. to save and CTRL + X. to end the file.

  4. Enter the following terminal command to restart your Raspberry Pi: restart sudo.

Raspberry Pi keyboard layout, configured

Incorrect keyboard configuration is known to create confusion and inconvenience on computers, as pressing the key on your keyboard may not match the letters on the screen. And it even applies to the raspberry pis.

Most of the confusion caused by misconfigured keyboards is due to the special character keys, as they don't have the same placement on the keyboard in all regions. So if you need to use the special character keys on your keyboard, configuring it for your region is a crucial step before you start working on your Raspberry Pi.

The 11 Best Raspberry Pi Projects for Beginners

These beginner Raspberry Pi projects are a great way to get started with the features of any Raspberry Pi model.

Continue reading

About the author

Yash Wate
(2 articles published)

More
By Yash Wate

Subscribe to our newsletter

Sign up for our newsletter to receive tech tips, reviews, free e-books, and exclusive offers!

One more step …!

Please confirm your email address in the email we just sent you.

Leave a Reply

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