环境
- Red Hat Enterprise Linux 7
问题
- How to set
LC_ALL
in Red Hat Enterprise Linux 7?
- How to set
LC_ALL
to persist after system reboot?
决议
- Append
LC_ALL
and the required locale to /etc/environment
file and log out for the changes to take effect.
For Example:
Raw
[root@example ~]# locale
LANG=en_AU.UTF-8
LC_CTYPE="en_AU.UTF-8"
LC_NUMERIC="en_AU.UTF-8"
LC_TIME="en_AU.UTF-8"
LC_COLLATE="en_AU.UTF-8"
LC_MONETARY="en_AU.UTF-8"
LC_MESSAGES="en_AU.UTF-8"
LC_PAPER="en_AU.UTF-8"
LC_NAME="en_AU.UTF-8"
LC_ADDRESS="en_AU.UTF-8"
LC_TELEPHONE="en_AU.UTF-8"
LC_MEASUREMENT="en_AU.UTF-8"
LC_IDENTIFICATION="en_AU.UTF-8"
LC_ALL=
[root@example ~]# cat /etc/locale.conf
LANG="en_AU.UTF-8"
- To set
LC_ALL=en_US.UTF-8
append this entry in /etc/environment
Raw
[root@example ~]# cat /etc/environment
LC_ALL=en_US.UTF-8
Logout and then log in for the effect to take place
Raw
[root@example ~]# locale
LANG=en_US.UTF-8
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=en_US.UTF-8
- This changes can also be performed in
/etc/locale.conf
however, the Lang parameter will not change and if the output of #locale
command is checked, it will show the original value. To avoid confusion, it is better to modify /etc/environment