刚才远程登录linux服务器时,突然提示cannot change locale (en_US.UTF-8)警告:
-bash: warning: setlocale: LC_CTYPE: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_MESSAGES: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_NUMERIC: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_TIME: cannot change locale (en_US.UTF-8): No such file or directory
解决方案也很简单:
$ tee /etc/environment <<- 'EOF'
LANG=en_US.utf-8
LC_ALL=
EOF
$ source /etc/environment
$ localedef -v -c -i en_US -f UTF-8 en_US.UTF-8