Xshell5显示乱码问题

问题场景:

当前登录的操作系统及编码与通过ssh跳转后的目标主机的操作系统及编码都不相同,出现中文乱码。

查看Linux操作系统版本及编码:

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中提示信息显示为中文,想改为英文

操作系统信息

centos6.8

解决方案:

修改/etc/sysconfig/i18n的LANG属性值,并重新加载配置文件

 

[root@hadoop1 etc]# cat /etc/sysconfig/i18n
#LANG="zh_CN.UTF-8"
LANG="en_US.UTF-8"
[root@hadoop1 etc]# source /etc/sysconfig/i18n
[root@hadoop1 etc]# groupdel --help
Usage: groupdel [options] GROUP

Options:
  -h, --help                    display this help message and exit
  -R, --root CHROOT_DIR         directory to chroot into

 

posted @ 2019-04-22 00:30  人间丶迷走  阅读(1161)  评论(0编辑  收藏  举报