dcsimg
Linux Today: Linux News On Internet Time.




More on LinuxToday


EarthWeb: Linux Console Colors & Other Tricks

Feb 03, 2001, 13:07 (0 Talkback[s])
(Other stories by Jay Link)

WEBINAR:
On-Demand

Re-Imagining Linux Platforms to Meet the Needs of Cloud Service Providers


"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 "\033[35;1m Shocking \033[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 \033 , 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

Related Stories: