<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>physos.org &#187; unix</title>
	<atom:link href="http://physos.org/category/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://physos.org</link>
	<description>by Rainer &#34;physos&#34; Endres</description>
	<lastBuildDate>Tue, 01 Jun 2010 09:02:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Bash Prompting</title>
		<link>http://physos.org/2006/07/12/bash-prompting/</link>
		<comments>http://physos.org/2006/07/12/bash-prompting/#comments</comments>
		<pubDate>Wed, 12 Jul 2006 13:56:53 +0000</pubDate>
		<dc:creator>physos</dc:creator>
				<category><![CDATA[kde]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://physos.org/2006/07/12/bash-prompting/</guid>
		<description><![CDATA[I pasted my bash prompt some months ago on a KDE channel on IRC. Today I got a nice e-mail, asking for it, since it was lost in a hard disk format. This made me realize how much I like that prompt and how used to it, I am. So i decided to put it [...]]]></description>
			<content:encoded><![CDATA[<p>I pasted my bash prompt some months ago on a KDE channel on IRC. Today I got a nice e-mail, asking for it, since it was lost in a hard disk format. </p>

<p>This made me realize how much I like that prompt and how used to it, I am. So i decided to put it here, to have a <em>backup</em>. :)</p>

<p><code>\[\e[32m\][\u@\h]\[\e[0m\]\[\e[37m\][\t]\[\e[0m\]\n\[\e[34m\][\w]\[\e[0m\]&gt;</code></p>

<p>Obviously thats <strong>very</strong> bash. </p>

<p>Short explanation:</p>

<pre><code>\[\e[32m\]
</code></pre>

<p>This turns on the green <em>pen</em>, everything is now in green ( Numerical code: 32 ) </p>

<pre><code>[\u@\h]
</code></pre>

<p>The user (\u) and host (\h) with some eyecandy provided by @ and square brackets. This resolves on my laptop to: </p>

<pre><code>[physos@davinci]

\[\e[0m\]
</code></pre>

<p>turning off the green pen</p>

<pre><code>\[\e[37m\]
</code></pre>

<p>turning on the grey pen</p>

<pre><code>[\t]
</code></pre>

<p>printing the current time in square brackets</p>

<pre><code>\n
</code></pre>

<p>adding a newline character which does what it says</p>

<pre><code>\[\e[34m\]
</code></pre>

<p>turning on the blue pen</p>

<pre><code>[\w]
</code></pre>

<p>current working directory </p>

<pre><code>&gt;
</code></pre>

<p>and a nice little bracket to sum it up (change that to $ to be more compatible with textbooks about Linux)</p>

<p>When you do not get lost in square brackets and backslashs, you get something like this.</p>

<p><img src="http://physos.net/blogimages/bash_prompt.png" alt="screenshot of the described bash prompt" /></p>

<p>Write a <code>export PS1=</code> in front of it and put it into your <code>~/.bashrc</code>. Voila, bash glamour. </p>

<p>If you want to experiment with colors, i.e. red for root (31), I have here a list of codes.</p>

<p><img src="http://physos.net/blogimages/bash_colors.png" alt="screenshot of a colored list" /></p>

<p>This is just a short glimpse into the world of the Bash Prompt. I learned all I know from the excellent <a href="http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/index.html">Bash Prompt HowTo</a> in the <a href="http://www.tldp.org">Linux Documentation Project</a> repository of Linux wisdom. You can find floating clocks, bold text and other miracles inside an environment variable named <code>$PS1</code> there. Thanks to Giles Orr for providing this nice HowTo and the bash authors for allowing to adjust my environment to my needs, not the other way around. </p>
]]></content:encoded>
			<wfw:commentRss>http://physos.org/2006/07/12/bash-prompting/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
