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

  

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

  1. centos7 修改中文字符集

    CentOS 7字符集的问题与6有点区别,会出现下面问题,查看是中文,vi进入就变成乱码了 生产中修改配置文件   [root@ce1d2002a999 ~]# cat /etc/locale.con ...

  2. linux修改中文字符集

    //修改系统配置 cd /etc/profile //末尾加如下代码 export LC_ALL="zh_CN.GBK"export LANG="zh_CN.GBK&qu ...

  3. 【Linux】CentOS7中修改中文字符集

    CentOS 7中字符集查看的方式是 locale -a   或者locale 如果想显示中文的话,应该修改为 LANG="zh_CN.UTF-8" 在命令行界面临时修改字符集的话 ...

  4. (转)在CentOS中修改中文字符集

    虽然在实际工作环境下,Linux中不建议使用中文,但是如果一定要进行中文显示,尤其对于刚接触linux且英语基础不太好的人来说,那么本文具有一定的参考价值. 本文介绍在linux的shell环境下优化 ...

  5. Linux的默认编码可以通过export LC_ALL=zh_CN.GBK来修改

    http://www.cnblogs.com/malecrab/p/5300486.html

  6. Linux下修改默认字符集--->解决Linux下Java程序种中文文件夹file.isDirectory()判断失败的问题

    一.问题描述: 一个项目中为了生成树状目录,调用了file.listFiles()方法,然后利用file.isDirectory()方法判断是否为目录,该程序在windows下运行无问题,在Linux ...

  7. CentOS7及Docker配置中文字符集问题

    说明 Linux系统默认使用英文字符集,不会安装中文字符集等其他字符. 查看当前字符集 $ 安装字符集 使用locale命令看看当前系统所使用的字符集 $ locale LANG=en_US.UTF- ...

  8. centos7.2中文乱码解决办法

    centos7.2 中文乱码解决办法 1.查看安装中文包: 查看系统是否安装中文语言包 (列出所有可用的公共语言环境的名称,包含有zh_CN) # locale -a |grep "zh_C ...

  9. centos中文字符集,中文日志

    # CentOS 7 $ firewall-cmd --zone=public --add-port=80/tcp --permanent # nginx 端口 $ firewall-cmd --zo ...

随机推荐

  1. Android JNI中C和JAVA代码之间的互相调用

    关于Android studio中使用NDK/JNI环境和入门:http://blog.csdn.net/quan648997767/article/details/64923143 1. C代码回调 ...

  2. Backbone.js 使用 Collection

    在前面我们的 Backbone.js 用上了 Model, 但绝大数的情况下我们处理的都是一批的 Model 数据列表,所以需要有一个 Collection 来容纳 Model, 就像 Java 里最 ...

  3. [BUG] Dashboard报错:if usages['subnets']['available'] <= 0: KeyError: 'available'

    Openstack版本号:Liberty 系统平台:CentOS 7.2 64bit ######################################################### ...

  4. Android -- DiskLruCache

    DiskLruCache 创建一个磁盘缓存对象: public static DiskLruCache open(File directory, int appVersion, int valueCo ...

  5. Android -- Toolbar跟随ListView滑动隐藏和显现

    布局 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:too ...

  6. Spring(十一):Spring配置Bean(四)SpEL

    Spring表达式语言:SpEL 1)Spring表达式语言(简称SpEL):是一个支持运行时查询和操作对象图的强大的表达式语言. 2)语法类似于EL:SpEL使用#{...}作为界定符,所有在大框号 ...

  7. Using Timers in MFC Applications

    Timer Events in MFC Applications Event timers are always handy to have around and useful in nearly e ...

  8. CSOM中如何取到managed metadata类型字段的类型信息

    Field.fieldTypeKind返回的是Invalid [解决方法] There is no "Metadata" type of field in the SP.Field ...

  9. 如何检查显卡类型,DirectX和OpenGL的版本

    How To: Check the graphics card type and OpenGL version From: http://support.esri.com/technical-arti ...

  10. Office 超级录屏如何旋转视频90度之后保存

    打开视频转换专家   添加视频后点击编辑,然后在旋转的地方设置旋转,应用   输出可以正常播放