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. go语言之进阶篇error接口的使用

    1.error接口的使用 示例: package main import "fmt" import "errors" func main() { //var e ...

  2. cesium and three.js【转】

    https://blog.csdn.net/zhishiqu/article/details/79077883 这是威尔逊Muktar关于整合Three.js与铯的客人帖子.Three.js是一个轻量 ...

  3. Groupnet, Subnet, IP Pool的概念

    Groupnet是OneFS 8.0新引入的network object,专门为了服务Multi-Tenancy而创建,目的是让OneFS可以同时地处理多套网络配置. 如果用户不需要使用multi-t ...

  4. 利用vue-cropper做的关于图片裁剪、压缩、上传、预览等做的一个公共组件

    公共组件: <template> <div> <div class="upload-box"> <div class="imag ...

  5. window.location属性用法及解决一个window.location.search为什么为空的问题

    通常用window.location该属性获取页面 URL 地址: 1.什么是window.location? 比如URL:http://b.a.com:88/index.php?name=kang& ...

  6. Win32进程创建、进程快照、进程终止用例

    进程创建: 1 #include <windows.h> #include <stdio.h> int main() { // 创建打开系统自带记事本进程 STARTUPINF ...

  7. vim高级用法

    http://vim.wikia.com/wiki/Using_command-line_history ----------------------------------------------- ...

  8. 强制开启android webview debug模式使用Chrome inspect

    强制开启android webview debug模式使用Chrome inspect https://blog.csdn.net/zhulin2609/article/details/5143782 ...

  9. OpenGL book list

      From: https://www.codeproject.com/Articles/771225/Learning-Modern-OpenGL   A little guide about mo ...

  10. 在CentOS 7上安装Kafka

    简介 Kafka 是一种高吞吐的分布式发布订阅消息系统,能够替代传统的消息队列用于解耦合数据处理,缓存未处理消息等,同时具有更高的吞吐率,支持分区.多副本.冗余,因此被广泛用于大规模消息数据处理应用. ...