Use echo in shell to print the color font and background

Source: Internet
Author: User

Use echo in shell to print the color font and background

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"

Study the rest by yourself!

Ubuntu 14.04 right-click Terminal settings

Linux multi-window split-screen terminal -- Terminator

How to modify the logon color of an ssh command line

Use the ls command in Ubuntu to display and modify the file color.

This article permanently updates the link address:

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.