Home > Operation and Maintenance > Linux Operation and Maintenance > How to modify the character set in linux

How to modify the character set in linux

青灯夜游
Release: 2022-01-05 18:03:51
Original
5988 people have browsed it

Methods to modify the character set: 1. Directly set "export LANG=required character set"; 2. Open the "/etc/sysconfig/i18n" file and set "LANG="required character set" SYSFONT ="latarcyrheb-sun16".

How to modify the character set in linux

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

1. Check the character set

Common methods:

(1)

[root@devhxyw03 ~]# echo $LANG zh_CN.GBK
Copy after login

(2)

[root@devhxyw03 ~]# env | grep LANG LANG=zh_CN.GBK
Copy after login

(3)

[root@devhxyw03 ~]# export | grep LANG declare -x LANG="zh_CN.GBK"
Copy after login

(4)

[root@devhxyw03 ~]# locale
LANG=zh_CN.GBK
LC_CTYPE="zh_CN.GBK"
LC_NUMERIC="zh_CN.GBK"
LC_TIME="zh_CN.GBK"
LC_COLLATE="zh_CN.GBK"
LC_MONETARY="zh_CN.GBK"
LC_MESSAGES="zh_CN.GBK"
LC_PAPER="zh_CN.GBK"
LC_NAME="zh_CN.GBK"
LC_ADDRESS="zh_CN.GBK"
LC_TELEPHONE="zh_CN.GBK"
LC_MEASUREMENT="zh_CN.GBK"
LC_IDENTIFICATION="zh_CN.GBK"
LC_ALL=
Copy after login

2. Modify the character set

(1) Modify by directly setting variables, which only works for the temporary shell

export LANG=zh_CN.UTF-8
Copy after login
Copy after login

(2) Modify the file , by modifying the /etc/sysconfig/i18n file control, it will be permanently effective for this machine

[root@devhxyw03 ~]# vim /etc/sysconfig/i18n

LANG="zh_CN.GBK" SYSFONT="latarcyrheb-sun16" 
~ ~~[root@devhxyw03 ~]# source /etc/sysconfig/i18n
Copy after login

(3) Modify the .bash_profile file in the current user’s home directory, and source the file to take effect, and it will be permanently effective for the current user

export LANG=zh_CN.UTF-8
Copy after login
Copy after login

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of How to modify the character set in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template