21.xshell远程终端主机字不显示颜色

xshell远程终端主机字不显示颜色

一直使用的xshell都是只有单一颜色的,但是其实是可以设置xshell根据不同文字类型设置不同的显示颜色的。
原因是因为我自己的.bashrc文件中 terminal color 功能给注释掉了,我的直接取消注释就可以 。

1. 查看 .bashrc 文件

lyq@a512-3060:~$ vim ~/.bashrc 

2. 取消注释

找到终端颜色区域

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt

在这里插入图片描述

3. 启用

lyq@a512-3060:~$ source ~/.bashrc 

4. 对比效果

在这里插入图片描述

注意:

  • 好几个Ubuntu系统这个文件中都有这么一段话force_color_prompt=yes,并且是被注释掉的,这时候只需要将注释给去掉,然后重新source ~/.bashrc既可。
  • 文件中若是没有这么一段话的,那就请粘贴这一大段话进去,并且保存。
    然后重新source ~/.bashrc既可。
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt

force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
        # We have color support; assume it's compliant with Ecma-48
        # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
        # a case would tend to support setf rather than setaf.)
        color_prompt=yes
    else
        color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值