使用locale
查看当前的语言环境设置
LANG=zh_CN.UTF-8 LANGUAGE= 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=
或者 $LANG
查看语言环境
zh_CN.UTF-8:未找到命令
安装中文语言包
sudo apt-get install language-pack-zh-han*
运行语言支持检查
sudo apt install $(check-language-support)
修改配置文件
sudo vim /etc/default/locale
将原始内容注释掉或删掉,替换为如下内容:
LANG="zh_CN.UTF-8" LANGUAGE="zh_CN:zh" LC_NUMERIC="zh_CN" LC_TIME="zh_CN" LC_MONETARY="zh_CN" LC_PAPER="zh_CN" LC_NAME="zh_CN" LC_ADDRESS="zh_CN" LC_TELEPHONE="zh_CN" LC_MEASUREMENT="zh_CN" LC_IDENTIFICATION="zh_CN" LC_ALL="zh_CN.UTF-8"
修改环境文件(环境变量(所有用户))
sudo vim /etc/profile
在最后一行加入
LANG="zh_CN.UTF-8"