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