This post is created 4 years ago, the content may be outdated.
本文介绍开启256色终端/SSH的方法,供日后查询。
操作方法
通过echo $TERM
查询当前终端,使用tput colors
查询当前支持色彩数
编辑用户目录下的.bashrc
,取消force_color_prompt=yes
前的注释。
在此句后添加以下代码
1 2 3 4 5
| if [ -e /lib/terminfo/x/xterm-256color ] || [ -e /usr/share/terminfo/x/xterm-256color]; then export TERM='xterm-256color' else export TERM='xterm-color' fi
|
如不支持xterm-256color则安装ncurses
:
1
| apt install ncurses-base
|