How to set LC_ALL for systemwide changes?

本文介绍如何在Red Hat Enterprise Linux 7中永久设置LC_ALL环境变量,以实现系统范围内的语言和区域设置更改。通过修改/etc/environment文件,可以在系统重启后保持这些设置不变。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://access.redhat.com/solutions/3533681

How to set LC_ALL for systemwide changes?

 SOLUTION UNVERIFIED - 已更新 2018年七月19日02:20 - 

English 

环境

  • 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 #localecommand is checked, it will show the original value. To avoid confusion, it is better to modify /etc/environment
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值