Methods for printing color fonts and color backgrounds using echo in the shell _linux shell

Source: Internet
Author: User

It's fun for the terminal print in the shell!
First know that the end of the shell print has echo printf is commonly used is echo slightly;

Note: Font Color reset = 0, black = 30, red = 31, green = 32, ***=33, blue = 34, magenta =35, cyan = 36, white =37.
Background color reset = 0, black = 40, red = 41, green = 42, ***=43, blue = 44, magenta =45, cyan = 46, white =47.

To print color text, enter the following command:

Copy Code code as follows:

# echo-e "\e[1;36m \e[0m"

\E[1;36 sets the color to cyan \e[0 resets the color back. 4 If you want other colors, you just have to replace 36 with the number of other colors corresponding to the line;

To set a color background, you can enter the following command:

Copy Code code as follows:

# echo-e "\e[1;41m \e[0m"

The rest of you go play!

Related Article

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.