How To Set Locale In Linux? – POFTUT

How To Set Locale In Linux?


The locale is the configuration of a Linux system that provides a region, keyboard, time-related data. The locale is important because it will change the interpretation of some keyboards etc. If you are getting the following warning like “Setting locale failed” we will look at how to solve it.

List Current Locale Setting

Listing of current locale settings can be done just by issuing locale commands. We do not need to provide an option for listing.

$ locale
List Current Locale Setting
List Current Locale Setting

As we can see that there are different locale settings like TIME, ADDRESS , MEASUREMENT, MONETARY etc.

Change Local Variable

We see that LC_ALL environment variable is not set and the problem is that some application needs this locale to be set. We will use update-locale command in order to change the current locale. We will also provide the locale we want to set which is en_US.UTF-8 in this example.

$ sudo update-locale LC_ALL="en_US.UTF-8"
  • update-locale is a command which will update locale configuration
  • LC_ALL="en_US.UTF-8" is the locale variable we want to update
$ locale

To effect the settings log out and log in for locale command.

Change Local Variable
Change Local Variable

LEARN MORE  "Perl warning Setting locale failed" Error and Solution In Linux

Leave a Comment