一般使用Xshell通過SSH串連管理Centos/Debina伺服器終端為8色,通過設定終端類型可開啟256色彩以顯示更加鮮豔的色彩。查看當前終端類型: echo $TERM xterm-color 查看當前伺服器終端色彩: tput colors8 或使用以下指令碼檢測並以色彩方式: #!/usr/bin/env python#檢測當前終端支援色彩import sysimport os def echo(msg): os.system('echo -n "' + str(msg) + '"') def out(n): os.system("tput setab " + str(n) + "; echo -n " + ("\"% 4d\"" % n)) os.system("tput setab 0") # normal colors 1 - 16os.system("tput setaf 16")for n in range(8): out(n)echo("\n")for n in range(8, 16): out(n) echo("\n")echo("\n") y=16while y < 231: for z in range(0,6): out(y) y += 1 echo("\n") echo("\n") for n in range(232, 256): out(n) if n == 237 or n == 243 or n == 249: echo("\n") echo("\n") 配置Linux終端如果支援就調整為256色終端,添加到.bashrc檔案內。 if [ -e /usr/share/terminfo/x/xterm-256color ]; then#debian在/lib/terminfo/x/xterm-256color export TERM='xterm-256color'else export TERM='xterm-color'fi 如不支援xterm-256color安裝: apt-get install ncurses-baseyum install ncurses 擴充閱讀:Colour colour everywhere! 256 colour-mode for Linux consoles:http://www.robmeerman.co.uk/unix/256colours256 colors in vim:http://vim.wikia.com/wiki/256_colors_in_vim