centos7 修改中文字符集 How to avoid having to `export LC_ALL=“zh_CN.UTF-8”` upon each SSH connection...

Each time I SSH to my Fedora Server, the locale setting is not right.

$ locale

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: ??? LC_ALL ????????: ?????????
LC_CTYPE=UTF-8
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=

And each time I would have to $ export LC_ALL="zh_CN.UTF-8" to make the desired language work.

But I have already set LANG=zh_CN.UTF-8 and LC_ALL=zh_CN.UTF-8 in /etc/locale.conf/ and in ~/.bashrc.

Is there any way I can make the export permanent? Really appreciate a lot!!

 

You are missing the export in your ~/.bashrc.

export LC_ALL=zh_CN.UTF-8

When you login to your user in the remote server via ssh, the ~/.bashrc of that user will get sourced and the locale will be set.

 

实例配置:

[root@zhiyi-first-server ~]# cat ~/.bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi

# added by Anaconda3 installer
export PATH="/root/anaconda3/bin:/root/datainfra/tool/alihbase-1.1.4/bin:$PATH"

# java
export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64/jre"
export LC_ALL=zh_CN.UTF-8

  

 

转载于:https://www.cnblogs.com/weifeng1463/p/10314685.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值