Use echo in shell to print the color font and background

Source: Internet
Author: User
It's fun to print the terminal in shell! First, we know that echo is commonly used in the terminal printing echoprintf in shell. note: the font color is reset to 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 = 4

It's fun to print the terminal in shell!
First, we know that echo printf is usually used in shell Terminal Printing;

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 the color text, enter the following command:
 

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

Set \ e [1; 36 to cyan \ e [0 to reset the color. 4 If you want other colors, you only need to replace 36 with numbers corresponding to other colors;

To set a color background, enter the following command:
 

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

Let's play with the rest!

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.