centos7.3中文乱码

1.查看系统是否安装中文语言包 (列出所有可用的公共语言环境的名称,包含有zh_CN)

locale -a |grep "zh_CN"

2.修改配置文件

在修改配置文件之前,我们先看看当前系统语言环境
locale
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=

虽然安装了中文语言包但本机的语言环境并不是中文,需要修改locale.conf配置文件

vim /etc/locale.conf 
LANG="zh_CN" 

source /etc/locale.conf

也可以使用命令修改locale.conf配置文件

localectl set-locale LANG=zh_CN

接着修改/etc/profile文件

vim /etc/profile
export LANG=zh_CN.UTF-8

source /etc/profile
  1. 验证是否成功
ll

-rw-------. 1 root root 1901 11月 30 18:18 anaconda-ks.cfg
-rw-r--r--. 1 root root 1949 11月 30 18:19 initial-setup-ks.cfg
drwxr-xr-x. 2 root root    6 11月 30 18:19 公共
drwxr-xr-x. 2 root root    6 11月 30 18:19 模板
drwxr-xr-x. 2 root root    6 11月 30 18:19 视频
drwxr-xr-x. 2 root root    6 11月 30 18:19 图片
drwxr-xr-x. 2 root root    6 11月 30 18:19 文档
drwxr-xr-x. 2 root root    6 11月 30 18:19 下载
drwxr-xr-x. 2 root root    6 11月 30 18:19 音乐
drwxr-xr-x. 2 root root    6 11月 30 18:19 桌面
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值