How to Change or Set System Locales in Linux

A locale is a set of environmental variables that defines the language, country, and character encoding settings (or any other special variant preferences) for your applications and shell session on a Linux system. These environmental variables are used by system libraries and locale-aware applications on the system.

Locale affects things such as the time/date format, the first day of the week, numbers, currency and many other values formatted in accordance with the language or region/country you set on a Linux system.

In this article, we will show how to view your currently installed system locale and how to set system’s locale in Linux.

How to View System Locale in Linux

To view information about the current installed locale, use the locale or localectl utility.

$ locale

LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

$ localectl status

System Locale: LANG=en_US.UTF-8
      LANGUAGE=en_US
      VC Keymap: n/a
      X11 Layout: us
      X11 Model: pc105

You can view more information about an environmental variable, for example LC_TIME, which stores the time and date format.

$ locale -k LC_TIME

abday="Sun;Mon;Tue;Wed;Thu;Fri;Sat"
day="Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday"
abmon="Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec"
mon="January;February;March;April;May;June;July;August;September;October;November;December"
am_pm="AM;PM"
d_t_fmt="%a %d %b %Y %r %Z"
d_fmt="%m/%d/%Y"
t_fmt="%r"
t_fmt_ampm="%I:%M:%S %p"
era=
era_year=""
era_d_fmt=""
alt_digits=
era_d_t_fmt=""
era_t_fmt=""
time-era-num-entries=0
time-era-entries="S"
week-ndays=7
week-1stday=19971130
week-1stweek=1
first_weekday=1
first_workday=2
cal_direction=1
timezone=""
date_fmt="%a %b %e %H:%M:%S %Z %Y"
time-codeset="UTF-8"
alt_mon="January;February;March;April;May;June;July;August;September;October;November;December"
ab_alt_mon="Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec"

To display a list of all available locales use the following command.

$ locale -a

C
C.UTF-8
en_US.utf8
POSIX

How to Set System Locale in Linux

If you want to change or set system local, use the update-locale program. The LANG variable allows you to set the locale for the entire system.

The following command sets LANG to en_IN.UTF-8 and removes definitions for LANGUAGE.

$ sudo update-locale LANG=LANG=en_IN.UTF-8 LANGUAGE
OR
$ sudo localectl set-locale LANG=en_IN.UTF-8

To configure a specific locale parameter, edit the appropriate variable. For instance.

$ sudo update-locale LC_TIME=en_IN.UTF-8
OR
$ sudo localectl set-locale LC_TIME=en_IN.UTF-8

You can find global locale settings in the following files:

  • /etc/default/locale – on Ubuntu/Debian
  • /etc/locale.conf – on CentOS/RHEL

These files can also be edited manually using any of your favorite command line editors such as Vim or Nano, to configure your system locale.

To set a global locale for single user, you can simply open ~/.bash_profile file and add the following lines.

LANG="en_IN.utf8"
export LANG

For more information, see the locale, update-locale and localectl man pages.

$ man locale
$ man update-locale
$ man localectl

That’s all! In this short article, we have explained how to view and set system local in Linux. If you have any questions, use the feedback form below to reach us.

If you read this far, tweet to the author to show them you care. Tweet a thanks
Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

12 thoughts on “How to Change or Set System Locales in Linux”

  1. Hi,

    If I do:

    $ sudo localectl set-locale LANG=en_IN.UTF-8
    

    Does this also remove the thousands of locale directories from all the programs or does it just deactivate their use of them?

    Reply
  2. Whoever thought that the language of week- and month-names should be tied to the user’s locale and not the user’s display language was a really clever monkey. Take, for example, my system configured for English but a Hungarian locale: everything on my system displays in English EXCEPT for days and months which are in Hungarian!!!

    Seriously?! It must be the most illogical design that I have come across and it seems to be quite common on Linux systems. Nutters. Oh, and user-customization of locales is something completely overlooked on most Linux desktops. Argh!

    Reply
  3. Where it says:

    $ sudo update-locale LANG=LANG=en_IN.UTF-8 LANGUAGE
    

    should say:

    $ sudo update-locale LANG=en_IN.UTF-8 LANGUAGE
    

    and even better:

    $ update-locale LANG=LANG=en_IN.UTF-8 LANGUAGE
    

    … to update the locale of the current user, rather than root’s.

    Reply
  4. I have tried following the instructions here several times, but I still have the calendar showing Monday as the first day of the week, despite changing it to Sunday, i.e. day 1, using en_GB. The en_GB defaults to day 2, so I changed it and updated, etc. but it stays on a wrong day for the calendar.

    Reply
  5. Resume:
    1. This is on Ubuntu
    2. This is don’t work
    3. Pointed utilities unknown and absent and can’t be installed. Because of those utilities absent in any repository in you OS.

    So information is fully useless.

    Reply
        • @Poul

          I have never used a Mac OS so I can’t tell how you can install it. But try to use this guide to set system locale:

          To view or set the region on Mac OS X 10.10:

          Select System Preferences >Language & Region.

          Select a region and country from Region.

          Reply
          • Hi! How can I change locale’s vars? What command should I do? If I write in Terminal, for example, “LC_COLLATE="ru_RU.UTF-8var LC_COLLATE= does not change.

Got something to say? Join the discussion.

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.