search instagram arrow-down

Archives

Categories

Meta

Colorful Message in Console

For the colorful text in the Linux console you have to use the escape sequence code.You can use echo statement to print message, to use ANSI escape sequence you must use -e option (switch) with echo statement, general syntax is as follows

Syntax

echo   -e  “33[escape-code    your-message”

33, is escape character, which causes to take some action

After [ you would place a decimal no. and a letter for a specific action.

eg1. echo -e “33[31m This text is in Red:”

eg2. echo -e “33[32m This text is in Green:”

30-37 Set foreground color.

m useful to show characters in colors or in different effects such as bold.

 

To reset the color to normal,  use the command:

tput sgr0

 

For detail:

http://www.freeos.com/guides/lsst/misc.htm

 

Leave a Reply
Your email address will not be published. Required fields are marked *

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: