如果你的shell终端中文是乱码

下面是各种尝试:

[wz@supportserver-51 doc]$ ll
total 0
-rw-rw-r-- 1 wz wz 0 Apr 10 17:53 linux?????鼙???.pdf
[wz@supportserver-51 doc]$ export lang = zh_cn.gbk
-bash: export: `=': not a valid identifier
-bash: export: `zh_cn.gbk': not a valid identifier
[wz@supportserver-51 doc]$ export LANG = zh_CN.gbk
-bash: export: `=': not a valid identifier
-bash: export: `zh_CN.gbk': not a valid identifier
[wz@supportserver-51 doc]$ export lang=zh_cn.gbk
[wz@supportserver-51 doc]$ ll
total 0
-rw-rw-r-- 1 wz wz 0 Apr 10 17:53 linux?????鼙???.pdf
[wz@supportserver-51 doc]$ export LANG=zh_cn.gbk
[wz@supportserver-51 doc]$ ll
total 0
-rw-rw-r-- 1 wz wz 0 Apr 10 17:53 linux??????????.pdf
[wz@supportserver-51 doc]$ export LANG=zh_CN.gbk
[wz@supportserver-51 doc]$ ll
总用量 0
-rw-rw-r-- 1 wz wz 0 410 17:53 linux高性能编程.pdf
[wz@supportserver-51 doc]$ 

截图:

如果你的shell终端中文是乱码_第1张图片

最终结果是:

export LANG=zh_CN.gbk

注意linux是区分大小写的,另外等于号左右两边不要有空格。

延伸阅读

linux系统本身的编码设置在这里:

[wz@supportserver-51 bak]$ cat /etc/sysconfig/i18n 
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
[wz@supportserver-51 bak]$ 

可以在这里设置操作系统可以支持的字符编码。

你可能感兴趣的:(linux,shell)