标签:linux操作系统 cat color lc_all time shell style centos 配置文件
当前登录的操作系统及编码与通过ssh跳转后的目标主机的操作系统及编码都不相同,出现中文乱码。
cat /etc/redhat-release
当前登录主机
系统:Red Hat Enterprise Linux Server release 6.5 (Santiago)
编码:zh_CN.gb18030
目标主机
系统为:CentOS Linux release 7.5.1804 (Core)
编码:zh_CN.UTF-8
跳转到目标主机后,修改/etc/locale.conf文件
vi /etc/locale.conf
LANG=zh_CN.UTF-8 LC_CTYPE="zh_CN.UTF-8" LC_NUMERIC="zh_CN.UTF-8" LC_TIME="zh_CN.UTF-8" LC_COLLATE="zh_CN.UTF-8" LC_MONETARY="zh_CN.UTF-8" LC_MESSAGES="zh_CN.UTF-8" LC_PAPER="zh_CN.UTF-8" LC_NAME="zh_CN.UTF-8" LC_ADDRESS="zh_CN.UTF-8" LC_TELEPHONE="zh_CN.UTF-8" LC_MEASUREMENT="zh_CN.UTF-8" LC_IDENTIFICATION="zh_CN.UTF-8" LC_ALL=zh_CN.UTF-8
重新加载配置文件:
source /etc/locale.conf
注意:XShell设置的编码也是utf-8
标签:linux操作系统 cat color lc_all time shell style centos 配置文件
原文地址:https://www.cnblogs.com/is-raining/p/10747940.html