CentOS6 中/英文环境切换

使用locale查看当前使用的编码和字符集

locale

CentOS6 中/英文环境切换

使用locale -a查看当前支持的编码和字符集

locale -a | grep en_US #locale

-a会输出当前系统支持的所有编码和字符集,所以我这里使用grep只过滤en_US的字符集

CentOS6 中/英文环境切换

可以看到有en_US.utf8。一定要注意在第下一步修改中不要直接使用这里的en_US.utf8而要写成en_US.UTF-8形式,不然修改不生效系统会继续使用原先的中文编码。

在/etc/profile中修改LANG变量

echo ‘export LANG=en_US.UTF-8’ >> /etc/profile

在/etc/profile最后追加

reboot #重启操作系统