Although in the actual working environment, Linux does not recommend the use of Chinese, but if you have to do the Chinese display, especially for those who have just contacted Linux and the English Foundation is not very good, then this article has a certain reference value.
This article describes how to optimize the Chinese display of Linux in a Linux shell environment.
First, a brief introduction to the concept of character set:
Simply put, character set (Character set) is a collection of more than one character, character sets are many, each character set contains a different number of characters, common character set name: ASCII character set, GB2312 character set, GBK character set, UTF-8 character set, etc.
Under CentOS 7, the default path to the character set is generally saved in the/etc/sysconfig/i18n file. However, in the CentOS 7 version, the character set configuration file is located in/etc/locale.conf.
Before you modify the file, you can view the language packs that are already installed:
# locale-a
If there are no Chinese language packs such as "zh_cn.gb18030", you can install them by using the following command:
# yum Install Kde-l10n-chinese
#yum Reinstall Glibc-common
Edit configuration file through VI command after Setup completes
<span style= "FONT-SIZE:18PX;" > #vi/etc/locale.conf</span>
Then in the file the original related statements, such as
Lang= "en_US. UTF-8 "
By adding a "#" comment before the statement, and then adding a new statement:
Lang= "ZH_CN. GB18030 "
Quit saving after the modification is complete, and develop the habit of checking whether it has been modified. such as by order:
#cat/etc/locale.conf
Confirm that you have modified it, or you can view the changed system language variables by following these commands:
#locale
Lang=zh_cn. GB18030
lc_ctype= "ZH_CN. GB18030 "
lc_numeric=" ZH_CN. GB18030 "
lc_time=" ZH_CN. GB18030 "
lc_collate=" ZH_CN. GB18030 "
lc_monetary=" ZH_CN. GB18030 "
lc_messages=" ZH_CN. GB18030 "
lc_paper=" ZH_CN. GB18030 "
lc_name=" ZH_CN. GB18030 "
lc_address=" ZH_CN. GB18030 "
lc_telephone=" ZH_CN. GB18030 "
lc_measurement=" ZH_CN. GB18030 "
lc_identification=" ZH_CN. GB18030 "
lc_all=
It should be noted that after the modification is complete, it may not take effect immediately in the system. The change takes effect through the source command:
#source/etc/locale.conf
To this, the system can better display Chinese.
In addition, if the use of software such as SECURECRT and Linux remote connection, it is best to securcrt the character set of the software and Linux in accordance with the character set.
If you want to temporarily change to English, you can use the following command:
<span style= "FONT-SIZE:18PX;" > #LANG =en</span>
After the reboot, the modified content will be invalidated.