HowTo : Change Locale (Language and Character Set) in Linux
Locales are used in Linux to define which language and character set (encoding) the user uses.
In this article I'll show you how to :
- Check the Current Locale
- Get the List of Available Locales
- Add a New Locale
- Change the Locale for Current Session
- Change the Locale Permanently
- Change the Default System's Locale
Get the information about the current locale environment :
For example : Australian English using the UTF-8 encoding is en_AU.UTF-8
Look for available locales :
Adding New Locale
If you didn't find the desired language or encoding, you can search for them in the list of all supported locales :
Generate a new locale by running
# locale-gen ru_RU.UTF-8
# locale-gen fr_FR ISO-8859-1
Now you could see it in the list of available locales.
Change Locale for Current Session
Set the environment variable
# Set English locale $ LANG=en_US.utf8 # Set Russian locale $ LANG=ru_RU.utf8 # Set France locale $ LANG=fr_FR.iso-8859-15
Change Locale Permanently
Put the following line to bash profile (
Change Default System's Locale
Perform the following steps to permanently change system's locale.
Edit the file with default locales.
On Debian, Ubuntu, Linux Mint etc.:
On CentOS, RedHat etc.: