zoukankan      html  css  js  c++  java
  • 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
    

      

  • 相关阅读:
    Pytorch版本yolov3源码阅读
    Darknet卷基层浅层特征可视化教程
    YOLOv3-darknet 内容解析
    YOLOv2-darknet 内容解析
    YOLOv1-darknet 内容解析
    Qt5.2+opencv2.4.9配置安装过程
    Android程序示例
    【Cuda编程】加法归约
    算法设计与分析课程的时间空间复杂度
    【算法分析】实验 4. 回溯法求解0-1背包等问题
  • 原文地址:https://www.cnblogs.com/weifeng1463/p/10314685.html
Copyright © 2011-2022 走看看