How to set the $LANG and $LC_ALL properly
How to view the current locale setting
# locale
LANG=en_US
LC_CTYPE= "en_US"
LC_NUMERIC= "en_US"
LC_TIME= "en_US"
LC_COLLATE= "en_US"
LC_MONETARY= "en_US"
LC_MESSAGES= "en_US"
LC_ALL=en_US
How to change the locale setting
To change the current locale setting, first confirm that the desired locale is
installed on the system with:
# locale -a en_US en_UK fr_FR CIf the desired locale is not in the list, you will need to install the
appropriate packages for that locale. See the Note below for more information
about locale packages.
Note: To set a default locale for a user's environment, set the LANG or LC_*
variables in a user's shell intialization file such as $HOME/.profile or
$HOME/.bashrc
How to change the locale by setting the system default locale
LANG=C
LC_ALL=C
Example from the /etc/default/locale file:
# Lines of this file should be of the form VAR=value, where VAR is one of
# TZ, LANG, or any of the LC_* environment variables.
LANG=C
LC_ALL=CNote: The system must be rebooted after making changes to the /etc/default/init file in order for the changes to take effect.
How to verify the locale setting
After setting or changing the locale, verify that the locale is set correctly:
Check if the locale is set correctly by running the locale command without any
options:
# locale
LANG=C
LC_CTYPE= "C"
LC_NUMERIC= "C"
LC_TIME= "C"
LC_COLLATE= "C"
LC_MONETARY= "C"
LC_MESSAGES= "C"
LC_ALL=C
- momeunier's blog
- Add new comment
- 805 reads
