---

EarthWeb: Linux Console Colors & Other Tricks

“If you’ve just begun programming on the Linux console, you
may find yourself less than enthused about the available color
choices (or lack thereof). … The answer is surprisingly simple:
all you need are some console escape sequences.”

“Try typing the following at your command prompt:

   echo -e "33[35;1m Shocking 33[0m"

What you should have is the word “Shocking” appearing in bright
purple. (Sorry, electric pink is not an option).”

“This is made possible by 33 , the standard console “escape”
code, which is equivalent to ^[ , or 0x1B in hex. When this
character is received, the Linux console treats the subsequent
characters as a series of commands. These commands can do any
number of neat tricks, including changing text colors.”


Complete Story

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis