Mac ssh ubuntu linux 等系统时中文乱码

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/huntstart/article/details/80872224

如题,mac里面终端明明已经用了utf-8却在ssh时发生乱码,只要在ssh服务器端设置一下即可,非常简单。

在Linux系统中,找到用户目录下的.bashrc文件
cd ~
vi .bashrc #这个文件名有的系统可能不全是这样的,比如.bash_xxx都是有可能的,打开看下,如果里面都是些环境变量配置基本上就可以断定了。
####比如我这个显示的是这样的
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
####。。。。。

在这个文件最后加一行:export LC_CTYPE=en_US.UTF-8

然后退出vi,source ~/.bashrc 就可以了,重连ssh就能正常显示了。

猜你喜欢

转载自blog.csdn.net/huntstart/article/details/80872224