changing the current set locale on a Linux(Ubuntu)

5

2

I have a Ubuntu system on which current locale is(output of locale command):

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

I want to change it to en_GB, because some characters are not handled properly on the terminal display.

What is the command to change the locale?

What is the command to see what different locales are available on current system for me to set/try?

goldenmean

Posted 2011-07-28T14:16:57.227

Reputation: 2 087

IMO, switching away from UTF-8 is never a solution. I've had my last name mangled one time too many. – user1686 – 2011-07-28T17:47:33.037

What terminal are you using? most of the X11 terminal emulators support utf-8, and utf-8 is the new unix standard. – ctrl-alt-delor – 2014-01-08T15:19:50.163

Answers

6

The used locale is set via environment variables for the process (like the shell running in your terminal).

Most of the time it is sufficient to just change LANG, assuming you use bash

$ export LANG=en_GB

Put this into your ~/.profile file to make it work for all (even non-terminal) processes.

You can have a look at /usr/share/locale/ for some list of locales.

Benjamin Bannier

Posted 2011-07-28T14:16:57.227

Reputation: 13 999

Thanks. But when I was trying to set my locale to POSIX, but could not see any entry like 'POSIX' in /usr/share/locale file. – goldenmean – 2011-07-28T14:36:38.053

Try C for LANG. – Benjamin Bannier – 2011-07-28T14:37:54.393

4

You could also use locale -a to get a list of available locales on your system (in addition to /usr/share/locale/, there may be some found in /usr/lib/locale/. For setting the locale, there's also the command setlocale, but I never got that to work and used export as the user honk described.

newenglander

Posted 2011-07-28T14:16:57.227

Reputation: 349