Setting the correct system locale is important for many reasons. The locale setting controls how a lot of the information on the system is presented. It usually specifies the keyboard layout, input language and is used by many programs on the system. The system locale will also serve as the default user locale as well. In this quick tip we will cover how to list the available system locale settings, show the currently set locale and change the system locale settings using the localectl command. We will also show you how to set your user specific settings via the Gnome GUI.
Show the Current Locale Settings
You can show your current locale settings by simply running the localectl command with no options. Alternatively, you can specify status as an argument to achieve the same results.
[savona@rhel8 ~]$ localectl System Locale: LANG=US VC Keymap: us X11 Layout: us X11 Model: pc105+inet X11 Options: terminate:ctrl_alt_bksp [savona@rhel8 ~]$ localectl status System Locale: LANG=US VC Keymap: us X11 Layout: us X11 Model: pc105+inet X11 Options: terminate:ctrl_alt_bksp
List Available System Locale Settings
Before you change the locale settings, you should list the available settings to ensure your are using the correct syntax. You can list the available settings by using the list-locales option to the localectl command.
[savona@rhel8 ~]$ localectl list-locales C.utf8 aa_DJ aa_DJ.iso88591 aa_DJ.utf8 aa_ER aa_ER.utf8 aa_ER.utf8@saaho aa_ER@saaho aa_ET aa_ET.utf8 af_ZA af_ZA.iso88591 ... OUTPUT TRUNCATED...
HINT: The list will be paginated, you can display the whole list without the pager using the --no-pager option.
List Available Key Maps
You can list the available key maps similarly by using the list-keymaps option.
[savona@rhel8 ~]$ localectl list-keymaps ANSI-dvorak al al-plisi amiga-de amiga-us applkey at at-mac at-nodeadkeys ...OUTPUT TRUNCATED...
Changing the Locale Settings
Once you have listed and selected the appropriate locale you can set it using the set-locale option.
Example, setting local to US English:
sudo localectl set-locale LANG=en_US.UTF-8
Changing the Key Map
You can change to one of the available key maps by using the set-keymap options followed by the desired map.
Example, setting the keymap to US:
sudo localectl set-keymap us
NOTE: Changing the keymap will also change the X11 Layout and Models automatically. If this is not the desired effect, you can set the X11 settings separately.
Change User Specific Settings in GUI
You can change some of the settings for your currently logged in user by using the Gnome settings panel. Open the settings by clicking the drop down on the top right of the window and selecting the settings icon.
Once the settings are open, click Region & Language and select your desired options.
Conclusion
Changing the locale settings is simple once you know how to do it. Here we covered how to set the system wide settings, which are also used for the default user settings. We also discussed changing the user specific settings in the Gnome settings panel.
Resources
Join Our Newsletter
Categories
- Bash Scripting (17)
- Basic Commands (50)
- Featured (7)
- Just for Fun (5)
- Linux Quick Tips (98)
- Linux Tutorials (65)
- Miscellaneous (15)
- Network Tools (6)
- Reviews (2)
- Security (32)