Get your Linux command prompt to dazzle [Root@web etc]#

Source: Internet
Author: User

The CentOS version of the Linux command prompt is the default color, sometimes tired of watching, so give it a bit of color to see.

Command prompt symbol is made to PS1, it's help description can be man bash under Search PS1 can view, some function parameters, I do not introduce, at the command line input:

[email protected] etc] #PS1 = "\[\033[1;32m\][\[\033[1;31m\]\u\[\033[1;36m\]@\[\033[1;35m\]\h \[\033[1;33m\]\w\[\ 033[1;32m\]]\[\033[1;31m\]\\$\[\033[0m\] "

[root@web etc] #

The format of the character sequence color in PS1 is:\[\033[function; color code m\] character \[\033[0m\]

Color coding: Where number 30~37 is font color, number 40~47 is background color

Foreground background color function meaning

30 40 Black 0 OFF

31 41 Red 1 highlight

32 42 Green

33 43 Yellow

34 44 Blue

35 45 Purplish red

36 46 Cyan Blue

37 47 White  

This uses the font color, if you want to set the background color can use \[\033[function; font color; background color m\] character \[\033[0m\]

You want to set the character after the \[\033[0m\], that is, cancel the setting, or it will affect the following characters, unless you want to continue to set the color of the next character can not be canceled, put the cancellation at the end, will not affect the color of the command.

Get your Linux command prompt to dazzle [email protected] etc]#

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.