linux 中文乱码解决方法

1、用locale 查看命令

#locale

 

 如果看到有择安装了中文包

 

 2、设置中文字符集

第一种方法:临时生效

# export LANG="zh_CN.UTF-8"    # 设置为中文
# export LANG="en_US.UTF-8"    # 设置为英文,

#export LANG=C # 设置英文

第二种方法 永久生效 ,编辑 /etc/sysconfig/i18n

## 永久生效, 编辑/etc/sysconfig/i18n

LANG="zh_CN.UTF-8"

#重启linux系统

#reboot

#编辑 /etc/profile配置文件,添加如下一行
export LANG="zh_CN.UTF-8"
# 重新载入
# . /etc/profile

## 查看当前的字符集
# echo $LANG

#安装中文安装包

yum -y groupinstall chinese-support

posted @ 2020-09-03 09:58  刘宗帅  阅读(3164)  评论(0)    收藏  举报