<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Linux Terminal tip &#8211; avoid confusion</title>
	<atom:link href="http://egoh.com/2006/10/16/terminal-tip-avoid-confusion/feed/" rel="self" type="application/rss+xml" />
	<link>http://egoh.com/2006/10/16/terminal-tip-avoid-confusion/</link>
	<description>Blog of Eric Goh, Technology Entrepreneur, Early Adopter, Product Management Professional</description>
	<lastBuildDate>Tue, 24 Jan 2012 18:41:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Andy Nguyen</title>
		<link>http://egoh.com/2006/10/16/terminal-tip-avoid-confusion/comment-page-1/#comment-4289</link>
		<dc:creator>Andy Nguyen</dc:creator>
		<pubDate>Sat, 11 Apr 2009 01:32:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.egoh.com/2006/10/16/terminal-tip-avoid-confusion/#comment-4289</guid>
		<description>Or, if like me, you have a hard time using both white-on-black and black-on-white windows, use different colors of (bash) prompt for different hosts.

export PS1=&quot;\[^[[47m\] `hostname` \w \[^[[0m\]\[^[[46m\]\!&gt;\[^[[0m\] &quot;

^[[47m (ESC [ 4 7 m) and ^[[46m change the color of displayed characters; ^[[0m changes it back to no color.
^[[47;46m will turn on BOTH &quot;colors&quot; of 46 and 47, which is useful for setting a &quot;reverse video&quot; and a color at the same time for displayed characters.

\! is the number of the command in the command line history.

\w is the current working directory.

The \[ and \] tells bash not to get confused by the zero-width &quot;characters&quot; like ^[ in the prompt string.

To see that colors my &quot;terminal&quot; is capable of rendering, I usually do:

i=1
while [ $i -lt 255 ]; do echo &quot;^[[${i}m  ---- $i ----  ^[[0m&quot;; ((i++)); done

where &quot;^[&quot; is the ESC character.  In &quot;vi&quot;, you would input that as ^V^[.</description>
		<content:encoded><![CDATA[<p>Or, if like me, you have a hard time using both white-on-black and black-on-white windows, use different colors of (bash) prompt for different hosts.</p>
<p>export PS1=&#8221;\[^[[47m\] `hostname` \w \[^[[0m\]\[^[[46m\]\!&gt;\[^[[0m\] &#8221;</p>
<p>^[[47m (ESC [ 4 7 m) and ^[[46m change the color of displayed characters; ^[[0m changes it back to no color.<br />
^[[47;46m will turn on BOTH "colors" of 46 and 47, which is useful for setting a "reverse video" and a color at the same time for displayed characters.</p>
<p>\! is the number of the command in the command line history.</p>
<p>\w is the current working directory.</p>
<p>The \[ and \] tells bash not to get confused by the zero-width &#8220;characters&#8221; like ^[ in the prompt string.</p>
<p>To see that colors my "terminal" is capable of rendering, I usually do:</p>
<p>i=1<br />
while [ $i -lt 255 ]; do echo &#8220;^[[${i}m  &#8212;- $i &#8212;-  ^[[0m&#8221;; ((i++)); done</p>
<p>where &#8220;^[&#8221; is the ESC character.  In &#8220;vi&#8221;, you would input that as ^V^[.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

