ubuntu21设置语言

概述

ubuntu设置language编码

执行

env

  • ubuntu-21.10

01、查看locale

root@mvpbang:~# locale
LANG=C.UTF-8
LANGUAGE=
LC_CTYPE="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_PAPER="C.UTF-8"
LC_NAME="C.UTF-8"
LC_ADDRESS="C.UTF-8"
LC_TELEPHONE="C.UTF-8"
LC_MEASUREMENT="C.UTF-8"
LC_IDENTIFICATION="C.UTF-8"
LC_ALL=

root@mvpbang:~# locale -a  //查看支持的语言编码
C
C.UTF-8
POSIX

02、新增编码

apt-get install -y localepurge

/etc/locale.gen   //support locale

locale-gen en_US.UTF-8  //生成需要的locale

root@mvpbang:~# locale -a
C
C.UTF-8
POSIX
en_US.utf8

03、设置lang

echo 'LANG="en_US.UTF-8"' > /etc/default/locale

退出terminal在登录查看

04、再次check

root@mvpbang:~# locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
root@mvpbang:~# cat /etc/default/locale
LANG=en_US.UTF-8
root@mvpbang:~# local
local         locale        locale-check  localectl     localedef     locale-gen    localepurge
root@mvpbang:~# locale -a
C
C.UTF-8
en_US.utf8
POSIX
posted @ 2023-03-24 09:07  mvpbang  阅读(48)  评论(0编辑  收藏  举报