
























# 1. 更新源
sudo apt update
# 2. 安装中文语言包
sudo apt install -y language-pack-zh-hans language-pack-zh-hans-base
# 3. 生成中文 locale
sudo locale-gen zh_CN.UTF-8
# 4. 设置默认locale( 一直按向下的箭头,选 zh_CN.UTF-8,按空格,出现*,为选中)
sudo dpkg-reconfigure locales
# 5. 安装中文字体
sudo apt install -y fonts-wqy-microhei fonts-wqy-zenhei fonts-noto-cjk
===========================
服务器默认没中文字体,所以汉字方框 / 乱码:
sudo apt update
sudo apt install -y fonts-wqy-microhei fonts-wqy-zenhei fonts-noto-cjk
sudo locale-gen zh_CN.UTF-8
sudo dpkg-reconfigure locales
弹出界面操作:
# 临时加载环境变量
export LANG=zh_CN.UTF-8
export LC_ALL=zh_CN.UTF-8
# 重启
sudo reboot
正常结果必须全是:zh_CN.UTF-8
如果还是 en_US 就是没配置对,重新走第二步。
Windows 拷过来的文件很多是 GBK 编码,Linux 默认 UTF-8 会乱码。
sudo apt install -y convmv
# 进入你的文件目录
cd 你的文件夹路径
# 批量转码 GBK → UTF-8
convmv -f GBK -t UTF-8 -r --notest *
如果你是远程 SSH 看文件乱码:
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。