Linux command: Echo set color

Source: Internet
Author: User
Tags clear screen set background


echo to change the color, use the parameter-e
format: echo-e "\033[word background color; font Color m string \033[0m"
For example:
echo-e "\033[41;36m something here \033[0m"

Where 41 of the position represents the background, 36 of the position is the color of the word


< Span style= "font-size:16px;font-family: ' Song Body ', ' Arial Narrow ', Arial, serif;line-height:28px;" > Note:
1, The word background color and the text color are English "" "" "" "" ""
2, there's a m behind the text color
3, there can be no spaces before and after the string, If so, the output also has a space


those ASCII code is the whole story of the color call.
\033[, M ... \033[0m
Turn the font into red and keep flashing
#echo-E "\033[31m \33[05m please confirm if you want to stop the current squid process, enter [y/n] \033[0m"
or

#echo-E "\033[31m \033[05m please confirm if you want to stop the current squid process, enter [y/n] \033[0m"


Here are a few examples:


echo-e "\033[30m black word \033[0m"
echo-e "\033[31m Red character \033[0m "
echo-e" \033[32m green word \033[0m "
Echo-e "\033[33m yellow word \033[0m"
echo-e "\033[34m blue word \033[0m"
echo-e "\033[35m purple word \033[0m"
echo-e "\033[36m sky blue Word \033[0m"
echo-e "\033[37m white word \033[0m"
&NBSP;

Echo-e "\033[40;37m Black Bottom White \033[0m"
Echo-e "\033[41;37m Red bottom White \033[0m"
Echo-e "\033[42;37m Green bottom White \033[0m"
Echo-e "\033[43;37m Yellow \033[0m"
Echo-e "\033[44;37m Blue bottom White \033[0m"
Echo-e "\033[45;37m Purple \033[0m"
Echo-e "\033[46;37m sky blue Bottom White \033[0m"
Echo-e "\033[47;30m black character \033[0m on white background"


Word background color range: 49----

40: Black
41: Crimson
42: Green
43: Yellow
44: Blue
45: Purple
46: Dark green
47: White
Word color:-----------
30: Black
31: Red
32: Green
33: Yellow
34: Blue
35: Purple
36: Dark green
37: White

\33[0m Close All Properties
\33[1m setting High brightness
\33[4m underline
\33[5m Flashing
\33[7m Reverse Display
\33[8m blanking
\33[30m--\33[37m setting foreground color
\33[40m--\33[47m set background color
\33[na the cursor to move n rows
\33[NB cursor down n rows
\33[NC cursor Right shifts n rows
\33[nd cursor left n rows
\33[y;xh Setting the cursor position
\33[2j Clear Screen
\33[k clears the contents from the cursor to the end of the line
\33[s Save cursor position
\33[u Restore cursor position
\33[?25l Hide Cursor
\33[?25h Display Cursor


This article is from the "Learn Linux history" blog, please be sure to keep this source http://woyaoxuelinux.blog.51cto.com/5663865/1871128

Linux command: Echo set color

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.