As different users have different preferences for the operating system so they must want to customize it as per their preferences. Some might want different time zones in different languages and different countries with a different currency that they prefer on their Linux interface.
In this case, the locale is used as it can be used to change or set language, countries, time/date format, currencies, and many more as per the user preferences. So we are going to discuss such locales and discuss the process of changing or setting such locales on Linux.
We can look over the current system locale using the following command. With the command, we will get different variables that can be reset with different values as per user preference.
$locale
Also, using localectl status command, it will result the same.
$ localectl status
You can check all available locales on your Linux system with the following command:
$ locale -a
We can check the details of specific variables using the variable name. In case you want to check details on LC_TIME that stores the time and date format, LC_ADDRESS that stores streets or postal addresses format, LC_TELEPHONE that stores format of telephone settings, and so on.
To get such details, we can run the following commands:
$ locale -k LC_ADDRESS
$ locale -k LC_TIME
$ locale -k LC_TELEPHONE
$ locale -k LC_TIME
$ locale -k LC_ADDRESS
We can change or set system locale in Linux by using the update-locale program. Using the LANG variable, it will allow us to set up the locale for the entire system.
We can set the LANG to en_IN.UTF-8 LANGUAGE and remove the definition for language by using the following command.
$ sudo update-locale LANG=LANG=en_IN.UTF-8 LANGUAGE
Or,
$ sudo localectl set -locale LANG=en_IN.UTF-8
We can check or view the global locale setting in the following file on Linux:
$ sudo vim /etc/default/locale
We can modify the .bashrc profile after already setting the value of locale. Go through the following command:
$ sudo vim ~/.bashrc
To set the global locale for the single user, we can add the following line at the end of ~/.bashrc_profile
$ sudo vim ~/.bashrc_profile
LANG=”en_IN.UTF-8”
export LANG
To get more details on locale, update-locale, and localectl, we can check the manual section as below:
$ man locale
$ man update-locale
$ man localectl
In this article, you learnt how to set a system and view the locale on Linux. Thank you for reading.
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.
The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…
Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…
Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…
Focal Fossa will reach the End of Standard Support in May 2025, also known as…
Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…
Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…