Change the terminal color of the LinuxSSH terminal to 256 colors

Source: Internet
Author: User
Generally, Xshell is used to connect to and manage the Centos/Debina server terminal through SSH. by setting the terminal type, 256 colors can be enabled to display more colorful colors. View the current terminal type: echo $ TERMxterm-color view the color of the current server terminal: tputcolors8 or use the following... generally, Xshell is used to connect to and manage the Centos/Debina server terminal through SSH. by setting the terminal type, 256 colors can be enabled to display more colorful colors. View current terminal type: echo $ TERM xterm-color view current server terminal color: tput colors8 or use the following script to detect and color :#! /Usr/bin/env python # check that the current terminal supports color 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 = 16 while y <231: for z in range (): out (y) y + = 1 ec Ho ("\ n") echo ("\ n") for n in range (0, 232,256): out (n) if n = 237 or n = 243 or n = 249: echo ("\ n") echo ("\ n ") configure the Linux terminal to a 256-color terminal if supported, and add it. bashrc file. If [-e/usr/share/terminfo/x/xterm-256color]; then # debian in/lib/terminfo/x/xterm-256color export TERM = 'xterm-256color' else export TERM = 'xterm-color' fi if xterm-256color installation is not supported: apt-get install ncurses-baseyum install ncurses extension read: Colour color everywhere! 256 color-mode for Linux cmdles: http://www.robmeerman.co.uk/unix/256colours256 Colors in vim: http://vim.wikia.com/wiki/256_colors_in_vim

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.