Linux SSH終端terminal配色更改為256色

來源:互聯網
上載者:User

一般使用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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.