How to Set Locales (i18n) On a Linux or Unix

What is a “locale” on a Linux operating system? How do I set or get locals (i18n) values on a Linux operating system?

Locales defines language and country specific setting for your programs and shell session. You can use locales to see date, time, number, currency and other values formatted as per your country or language on a Linux or Unix-like system.[donotprint]
Tutorial details
Difficulty Easy (rss)
Root privileges No
Requirements None
Time 5m
[/donotprint] To set system’s locale you need use shell variable. For example, LANG variable can be used to set en_US (English US) language. This page shows how to set locales (i18n) on a Linux or Unix operating system.

How do I show current locale settings on a Linux or Unix?

The syntax is:
locale name
locale [options] name

The locale command displays information about the current locale, or all locales on the screen.

locales command examples

Simply type the following command:
$ locale

Fig.01 Show current locale on a Linux or Unix

Display all available locales on your Linux or Unix-like system

Pass the -a option to locale command:
$ locale -a
Sample outputs:


You also run the following command on a Debian or Ubuntu based system to see the list of all supported locales:
$ less /usr/share/i18n/SUPPORTED
Sample outputs:

aa_DJ.UTF-8 UTF-8
aa_DJ ISO-8859-1
aa_ER UTF-8
aa_ER@saaho UTF-8
aa_ET UTF-8
af_ZA.UTF-8 UTF-8
af_ZA ISO-8859-1
ak_GH UTF-8
am_ET UTF-8
an_ES.UTF-8 UTF-8
an_ES ISO-8859-15
anp_IN UTF-8
ar_AE.UTF-8 UTF-8
ar_AE ISO-8859-6
ar_BH.UTF-8 UTF-8
ar_BH ISO-8859-6
ar_DZ.UTF-8 UTF-8
el_CY ISO-8859-7
en_AG UTF-8
en_AU.UTF-8 UTF-8
en_AU ISO-8859-1
en_BW.UTF-8 UTF-8
en_BW ISO-8859-1
en_CA.UTF-8 UTF-8
en_CA ISO-8859-1
en_DK.UTF-8 UTF-8
en_DK.ISO-8859-15 ISO-8859-15
en_DK ISO-8859-1
en_GB.UTF-8 UTF-8
en_GB ISO-8859-1
en_GB.ISO-8859-15 ISO-8859-15
en_HK.UTF-8 UTF-8
en_HK ISO-8859-1
en_IE.UTF-8 UTF-8
en_IE ISO-8859-1
en_IE@euro ISO-8859-15
en_IN UTF-8
zh_CN.GB18030 GB18030
zh_CN GB2312
zh_HK.UTF-8 UTF-8
zh_SG.UTF-8 UTF-8
zh_SG GB2312
zh_TW.UTF-8 UTF-8
zh_TW BIG5
zu_ZA.UTF-8 UTF-8
zu_ZA ISO-8859-1

Locale category sections

The following category sections are defined by POSIX:

  6. LC_TIME

For example:
locale -c -k LC_NUMERIC

See the man page of locale(5) for more info on all keywords and options:
man 5 locale

View/set global locale for all users on a “CentOS/RHEL/Scientific Linux v5.x/6.x” and older

Edit or view /etc/sysconfig/i18n to set global locale for all users:
$ sudo cat /etc/sysconfig/i18n
$ sudo vi /etc/sysconfig/i18n
Sample outputs:


You can also edit /etc/profile and set global locale for all users:

export LANG

View/set global locale for all users on a “Fedora Linux v22” and “CentOS/RHEL/Scientific Linux 7.x” and above

Type the following command to see the current locale for all users:
$ cat /etc/locale.conf
Sample outputs:


You can use the following systemd command too:
$ localectl status
Sample outputs:

   System Locale: LANG=en_IN.UTF-8
       VC Keymap: in-eng
      X11 Layout: in
     X11 Variant: eng

To see all locales available, run:
$ localectl list-locales
To set the default global system locale for all users, type the following command as root:
$ sudo localectl set-locale LANG=localeValueHere
$ sudo localectl set-locale LANG=en_IN.UTF-8

View/set global locale for all users on a Debian or Ubuntu Linux

To see which locales are supported on Debian/Ubuntu, enter:
$ locale -a|more
To set the locales for all users, enter:
$ sudo locale-gen en_IN
$ sudo locale-gen en_IN.UTF-8

Finally run:
$ sudo update-locale
Another option is to run dpkg-reconfigure locales command and select the locale(s) you want to generate. At the end, you’ll be asked which one should be the default. If you have users who access the system through ssh, it is recommended that you choose None as your default locale:
$ sudo dpkg-reconfigure locales

How can I set global locale for one user?

Simply edit your bash shell profile file $HOME/.bash_profile:
$ vi ~/.bash_profile
Append/add/edit as follows:

export LANG

OR create a new .i18n file to user’s $HOME directory:
$ vi $HOME/.i18n
Append/add/edit the following as per your locale setting:


Save and close the file. Please note that ~/.bash_profile procedure should work on Linux, OS X, *BSD and many other Unix-like systems. See this page for more info.

🐧 Please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
1 comment… add one
  • marco May 2, 2017 @ 7:47

    interesting info, however you blog is aimed to use at work, please consider not playing music on ads, very unprofessional from you guys. cheers

Leave a Reply

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

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @