<?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>Make Tech Easier&#187; bash</title>
	<atom:link href="http://maketecheasier.com/tag/bash/feed" rel="self" type="application/rss+xml" />
	<link>http://maketecheasier.com</link>
	<description>Uncomplicating the complicated, making life easier</description>
	<lastBuildDate>Fri, 25 May 2012 14:58:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>More Useful and Interesting Bash Prompts</title>
		<link>http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19</link>
		<comments>http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19#comments</comments>
		<pubDate>Mon, 19 Sep 2011 23:58:06 +0000</pubDate>
		<dc:creator>Joshua Price</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://maketecheasier.com/?p=38494</guid>
		<description><![CDATA[A while back, we listed 8 Useful and Interesting Bash Prompts. That turned out to be one of our most popular articles, and still generates user response and feedback. This time we&#8217;ve found a few more gems, as well as some handy tips and tricks for having the coolest shell... <p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19&amp;title=More+Useful+and+Interesting+Bash+Prompts&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19">More Useful and Interesting Bash Prompts</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></description>
			<content:encoded><![CDATA[<p><img src="http://imagecdn.maketecheasier.com/2011/09/morebashprompts-small.png" alt="morebashprompts-small" title="morebashprompts-small" width="246" height="139" class="alignleft size-full wp-image-38543" />A while back, we listed <a href="http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04" target="_blank">8 Useful and Interesting Bash Prompts</a>.  That turned out to be one of our most popular articles, and still generates user response and feedback.  This time we&#8217;ve found a few more gems, as well as some handy tips and tricks for having the coolest shell prompt on the proverbial block.<br />
<span id="more-38494"></span></p>
<h3>Using These Prompts</h3>
<p>Some of the following prompts are one-liners, and can be pasted directly into your terminal for (temporary) use.  To make them permanent, you&#8217;ll have to paste the code into your <em>.bashrc</em> or <em>.bash_profile</em>.  </p>
<p>The larger, more complex prompts such as Twtty should be saved to their own script file (such as myprompt.sh), and you place a line like</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">source</span> myprompt.sh</pre></div></div>

<p>in your .basrc file to &#8220;import&#8221; them.  </p>
<h3>Twtty Prompt</h3>
<p>This is a two-line prompt that holds quite a bit of information including username, hostname, working directory, time, and command history number.  Because of the technical and visual complexity, it&#8217;s best to place this prompt script in its own file, then source it from your <em>.bashrc</em> or <em>.bash_profile</em> as described above.  </p>
<p><img src="http://imagecdn.maketecheasier.com/2011/09/morebashprompts-twtty.png" alt="morebashprompts-twtty" title="morebashprompts-twtty" width="561" height="111" class="aligncenter size-full wp-image-38528" /></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> prompt_command <span style="color: #7a0874; font-weight: bold;">&#123;</span>
&nbsp;
<span style="color: #007800;">TERMWIDTH</span>=<span style="color: #800000;">${COLUMNS}</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#   Calculate the width of the prompt:</span>
&nbsp;
<span style="color: #007800;">hostnam</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #007800;">$HOSTNAME</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;s/[\.].*//&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #666666; font-style: italic;">#   &quot;whoami&quot; and &quot;pwd&quot; include a trailing newline</span>
<span style="color: #007800;">usernam</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">whoami</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">cur_tty</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>tty <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;s/.*tty\(.*\)/\1/&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">newPWD</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PWD}</span>&quot;</span>
<span style="color: #666666; font-style: italic;">#   Add all the accessories below ...</span>
<span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #007800;">promptsize</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;--(<span style="color: #007800;">${usernam}</span>@<span style="color: #007800;">${hostnam}</span>:<span style="color: #007800;">${cur_tty}</span>)---(<span style="color: #007800;">${PWD}</span>)--&quot;</span> \
                 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot; &quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #007800;">fillsize</span>=<span style="color: #800000;">${TERMWIDTH}</span>-<span style="color: #800000;">${promptsize}</span>
<span style="color: #007800;">fill</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$fillsize</span>&quot;</span> <span style="color: #660033;">-gt</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> 
<span style="color: #000000; font-weight: bold;">do</span> 
    <span style="color: #007800;">fill</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${fill}</span>-&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #007800;">fillsize</span>=<span style="color: #800000;">${fillsize}</span><span style="color: #660033;">-1</span>
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$fillsize</span>&quot;</span> <span style="color: #660033;">-lt</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
   <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #007800;">cut</span>=<span style="color: #000000;">3</span>-<span style="color: #800000;">${fillsize}</span>
	<span style="color: #007800;">newPWD</span>=<span style="color: #ff0000;">&quot;...<span style="color: #007800;">$(echo -n $PWD | sed -e &quot;s/\(^.\{$cut\}\)</span>\(.*\)/\2/&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #ff0000;">&quot;
fi
}
&nbsp;
PROMPT_COMMAND=prompt_command
&nbsp;
function twtty {
&nbsp;
local GRAY=&quot;</span>\<span style="color: #7a0874; font-weight: bold;">&#91;</span>\033<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1</span>;30m\<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #ff0000;">&quot;
local LIGHT_GRAY=&quot;</span>\<span style="color: #7a0874; font-weight: bold;">&#91;</span>\033<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">0</span>;37m\<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #ff0000;">&quot;
local WHITE=&quot;</span>\<span style="color: #7a0874; font-weight: bold;">&#91;</span>\033<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1</span>;37m\<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #ff0000;">&quot;
local NO_COLOUR=&quot;</span>\<span style="color: #7a0874; font-weight: bold;">&#91;</span>\033<span style="color: #7a0874; font-weight: bold;">&#91;</span>0m\<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #ff0000;">&quot;
&nbsp;
local LIGHT_BLUE=&quot;</span>\<span style="color: #7a0874; font-weight: bold;">&#91;</span>\033<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1</span>;34m\<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #ff0000;">&quot;
local YELLOW=&quot;</span>\<span style="color: #7a0874; font-weight: bold;">&#91;</span>\033<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1</span>;33m\<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #ff0000;">&quot;
&nbsp;
case <span style="color: #007800;">$TERM</span> in
    xterm*)
        TITLEBAR='\[\033]0;\u@\h:\w\007\]'
        ;;
    *)
        TITLEBAR=&quot;</span><span style="color: #ff0000;">&quot;
        ;;
esac
&nbsp;
PS1=&quot;</span><span style="color: #007800;">$TITLEBAR</span>\
<span style="color: #007800;">$YELLOW</span>-<span style="color: #007800;">$LIGHT_BLUE</span>-<span style="color: #7a0874; font-weight: bold;">&#40;</span>\
<span style="color: #007800;">$YELLOW</span>\<span style="color: #007800;">$usernam</span><span style="color: #007800;">$LIGHT_BLUE</span><span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$YELLOW</span>\<span style="color: #007800;">$hostnam</span><span style="color: #007800;">$LIGHT_BLUE</span>:<span style="color: #007800;">$WHITE</span>\<span style="color: #007800;">$cur_tty</span>\
<span style="color: #800000;">${LIGHT_BLUE}</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>-<span style="color: #800000;">${YELLOW}</span>-\<span style="color: #800000;">${fill}</span><span style="color: #800000;">${LIGHT_BLUE}</span>-<span style="color: #7a0874; font-weight: bold;">&#40;</span>\
<span style="color: #007800;">$YELLOW</span>\<span style="color: #800000;">${newPWD}</span>\
<span style="color: #007800;">$LIGHT_BLUE</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>-<span style="color: #007800;">$YELLOW</span>-\
\n\
<span style="color: #007800;">$YELLOW</span>-<span style="color: #007800;">$LIGHT_BLUE</span>-<span style="color: #7a0874; font-weight: bold;">&#40;</span>\
<span style="color: #007800;">$YELLOW</span>\$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>H<span style="color: #000000; font-weight: bold;">%</span>M<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #007800;">$LIGHT_BLUE</span>:<span style="color: #007800;">$YELLOW</span>\$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #000000; font-weight: bold;">\&quot;</span>+<span style="color: #000000; font-weight: bold;">%</span>a,<span style="color: #000000; font-weight: bold;">%</span>d <span style="color: #000000; font-weight: bold;">%</span>b <span style="color: #000000; font-weight: bold;">%</span>y<span style="color: #000000; font-weight: bold;">\&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>\
<span style="color: #007800;">$LIGHT_BLUE</span>:<span style="color: #007800;">$WHITE</span>\$<span style="color: #007800;">$LIGHT_BLUE</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>-\
<span style="color: #007800;">$YELLOW</span>-\
<span style="color: #007800;">$NO_COLOUR</span> <span style="color: #ff0000;">&quot; 
&nbsp;
PS2=&quot;</span><span style="color: #007800;">$LIGHT_BLUE</span>-<span style="color: #007800;">$YELLOW</span>-<span style="color: #007800;">$YELLOW</span>-<span style="color: #007800;">$NO_COLOUR</span> <span style="color: #ff0000;">&quot;
}</span></pre></div></div>

<p>One important thing to note about this prompt is that the horizontal bar scales to fit the width of your terminal, and that the working directory line will truncate itself when it gets too large.</p>
<p>If you have any problems with the above code snippet, the plain text version can be downloaded <a href="http://dl.dropbox.com/u/6864546/twtty.sh">here</a>.  </p>
<h3>High-Performance Minimalist Prompt</h3>
<p>All the complexities of a fancy prompt like Twtty do take up extra CPU cycles, and while it&#8217;s certainly not going to grind your system to a halt, it can add up.  If you want something that packs a lot of info without slowing you down, I suggest this:</p>
<p><img src="http://imagecdn.maketecheasier.com/2011/09/morebashprompts-minimal.png" alt="morebashprompts-minimal" title="morebashprompts-minimal" width="419" height="93" class="aligncenter size-full wp-image-38531" /></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;[\d | <span style="color: #000099; font-weight: bold;">\T</span> -&gt; \w ...<span style="color: #000099; font-weight: bold;">\$</span>?]<span style="color: #000099; font-weight: bold;">\n</span>#&quot;</span></pre></div></div>

<p>One interesting thing to note here is the use of the variable <em>$?</em> at the end.  This signifies the exit status of the last command entered.  0 means all is well, any other number usually indicates an error.  </p>
<h3>Rob&#8217;s Prompt</h3>
<p>This is one of the more popular prompts <a href="http://blog.ubrio.us/nix/best-bash-prompt/" target="_blank">floating around</a> the Internet.  The code is small and simple, yet it gives many of the features found in the larger, more complex examples.  </p>
<p><img src="http://imagecdn.maketecheasier.com/2011/09/morebashprompts-robs.png" alt="morebashprompts-robs" title="morebashprompts-robs" width="585" height="127" class="aligncenter size-full wp-image-38534" /></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;\[\033[0;33m\][\!]\<span style="color: #780078;">`if [[ \$? = &quot;0&quot; ]]; then echo &quot;\\[\\033[32m\\]&quot;; else echo &quot;\\[\\033[31m\\]&quot;; fi\`</span>[\u.\h: \<span style="color: #780078;">`if [[ `</span>pwd|wc -c|tr -d &quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">` &gt; 18 ]]; then echo &quot;\\W&quot;; else echo &quot;\\w&quot;; fi\`</span>]<span style="color: #000099; font-weight: bold;">\$</span>\[\033[0m\] &quot;</span>; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;\033]0;<span style="color: #780078;">`hostname -s`</span>:<span style="color: #780078;">`pwd`</span>\007&quot;</span></pre></div></div>

<h3>MegaFancyPrompt</h3>
<p>The name is entirely deserved &#8211; this prompt is quite large and extremely fancy.  It&#8217;s got color, titlebar control, user-awareness, proxy detection, <a href="http://maketecheasier.com/multitask-at-linux-command-line/2011/04/28" target="_blank">screen</a> detection, job count, and more.  In short, just about every feature found in the other prompts we&#8217;ve mentioned can be found here, and quite a few others.  If you want it ALL in your prompt, this is it.  </p>
<p><img src="http://imagecdn.maketecheasier.com/2011/09/morebashprompts-megafancy.png" alt="morebashprompts-megafancy" title="morebashprompts-megafancy" width="546" height="72" class="aligncenter size-full wp-image-38541" /></p>
<p><em>Note:  Not all features are visible at all times, so while it may not look like much in the screenshot, you can check out the full (documented, commented) script file <a href="http://dl.dropbox.com/u/6864546/megafancy.sh">here</a> for details on how to get the visible parts you want. </em></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">COLOR_WHITE</span>=<span style="color: #ff0000;">'\033[1;37m'</span>
<span style="color: #007800;">COLOR_LIGHTGRAY</span>=<span style="color: #ff0000;">'033[0;37m'</span>
<span style="color: #007800;">COLOR_GRAY</span>=<span style="color: #ff0000;">'\033[1;30m'</span>
<span style="color: #007800;">COLOR_BLACK</span>=<span style="color: #ff0000;">'\033[0;30m'</span>
<span style="color: #007800;">COLOR_RED</span>=<span style="color: #ff0000;">'\033[0;31m'</span>
<span style="color: #007800;">COLOR_LIGHTRED</span>=<span style="color: #ff0000;">'\033[1;31m'</span>
<span style="color: #007800;">COLOR_GREEN</span>=<span style="color: #ff0000;">'\033[0;32m'</span>
<span style="color: #007800;">COLOR_LIGHTGREEN</span>=<span style="color: #ff0000;">'\033[1;32m'</span>
<span style="color: #007800;">COLOR_BROWN</span>=<span style="color: #ff0000;">'\033[0;33m'</span>
<span style="color: #007800;">COLOR_YELLOW</span>=<span style="color: #ff0000;">'\033[1;33m'</span>
<span style="color: #007800;">COLOR_BLUE</span>=<span style="color: #ff0000;">'\033[0;34m'</span>
<span style="color: #007800;">COLOR_LIGHTBLUE</span>=<span style="color: #ff0000;">'\033[1;34m'</span>
<span style="color: #007800;">COLOR_PURPLE</span>=<span style="color: #ff0000;">'\033[0;35m'</span>
<span style="color: #007800;">COLOR_PINK</span>=<span style="color: #ff0000;">'\033[1;35m'</span>
<span style="color: #007800;">COLOR_CYAN</span>=<span style="color: #ff0000;">'\033[0;36m'</span>
<span style="color: #007800;">COLOR_LIGHTCYAN</span>=<span style="color: #ff0000;">'\033[1;36m'</span>
<span style="color: #007800;">COLOR_DEFAULT</span>=<span style="color: #ff0000;">'\033[0m'</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Function to set prompt_command to.</span>
<span style="color: #000000; font-weight: bold;">function</span> promptcmd <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #7a0874; font-weight: bold;">history</span> <span style="color: #660033;">-a</span> 
    <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">SSH_FLAG</span>=<span style="color: #000000;">0</span>
    <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">TTY</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>tty <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> -F<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #ff0000;">'{print $2}'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${TTY}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> 
        <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">SESS_SRC</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">who</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TTY</span> &quot;</span>  <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $6 }'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># Titlebar</span>
    <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #800000;">${TERM}</span> <span style="color: #000000; font-weight: bold;">in</span> 
        xterm<span style="color: #000000; font-weight: bold;">*</span>  <span style="color: #7a0874; font-weight: bold;">&#41;</span>  
            <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">TITLEBAR</span>=<span style="color: #ff0000;">'\[\033]0;\u@\h: { \w }  \007\]'</span>
            <span style="color: #000000; font-weight: bold;">;;</span>
        <span style="color: #000000; font-weight: bold;">*</span>       <span style="color: #7a0874; font-weight: bold;">&#41;</span>  
            <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">TITLEBAR</span>=<span style="color: #ff0000;">''</span>                               
            <span style="color: #000000; font-weight: bold;">;;</span>
    <span style="color: #000000; font-weight: bold;">esac</span>
    <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${TITLEBAR}</span>&quot;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># Test for day change.</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #007800;">$DAY</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">DAY</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>A<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">else</span>
        <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">today</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>A<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${DAY}</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;<span style="color: #007800;">${today}</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
            <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span><span style="color: #000099; font-weight: bold;">\n</span>\[<span style="color: #007800;">${COLOR_GREEN}</span>\]Day changed to <span style="color: #007800;">$(date '+%A, %d %B %Y')</span>.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
            <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">DAY</span>=<span style="color: #007800;">$today</span>
       <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># User</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${UID}</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${USER}</span>&quot;</span> == <span style="color: #ff0000;">&quot;<span style="color: #007800;">${LOGNAME}</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${SUDO_USER}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_RED}</span>\]\u&quot;</span>
            <span style="color: #000000; font-weight: bold;">else</span>
                <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_LIGHTRED}</span>\]\u&quot;</span>
            <span style="color: #000000; font-weight: bold;">fi</span>
        <span style="color: #000000; font-weight: bold;">else</span>                               
            <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_YELLOW}</span>\]\u&quot;</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">else</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${USER}</span> == <span style="color: #800000;">${LOGNAME}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>     
            <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_GREEN}</span>\]\u&quot;</span>
        <span style="color: #000000; font-weight: bold;">else</span>                               
            <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_BROWN}</span>\]\u&quot;</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># HTTP Proxy var configured or not</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$http_proxy</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_GREEN}</span>\]@&quot;</span>
    <span style="color: #000000; font-weight: bold;">else</span>                               
        <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_LIGHTRED}</span>\]@&quot;</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># Host</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${SSH_CLIENT}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${SSH2_CLIENT}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> 
        <span style="color: #007800;">SSH_FLAG</span>=<span style="color: #000000;">1</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${SSH_FLAG}</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> 
       <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_CYAN}</span>\]\h &quot;</span>
    <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #800000;">${SESS_SRC}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> 
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${SESS_SRC}</span>&quot;</span> == <span style="color: #ff0000;">&quot;(:0.0)&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> 
        <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_GREEN}</span>\]\h &quot;</span>
        <span style="color: #000000; font-weight: bold;">else</span> 
            <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">parent_process</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${PPID}</span><span style="color: #000000; font-weight: bold;">/</span>cmdline<span style="color: #000000; font-weight: bold;">`</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$parent_process</span>&quot;</span> == <span style="color: #ff0000;">&quot;in.rlogind*&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_BROWN}</span>\]\h &quot;</span>
            <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$parent_process</span>&quot;</span> == <span style="color: #ff0000;">&quot;in.telnetd*&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> 
                <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_YELLOW}</span>\]\h &quot;</span>
            <span style="color: #000000; font-weight: bold;">else</span>
                <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_LIGHTRED}</span>\]\h &quot;</span>
            <span style="color: #000000; font-weight: bold;">fi</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${SESS_SRC}</span>&quot;</span> == <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_GREEN}</span>\]\h &quot;</span>
    <span style="color: #000000; font-weight: bold;">else</span>                                 
        <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_RED}</span>\]\h &quot;</span> 
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># Detached Screen Sessions</span>
    <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">DTCHSCRN</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">screen</span> <span style="color: #660033;">-ls</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-c</span> Detach <span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${DTCHSCRN}</span> <span style="color: #660033;">-gt</span> <span style="color: #000000;">2</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_RED}</span>\][scr:<span style="color: #007800;">${DTCHSCRN}</span>] &quot;</span>
    <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${DTCHSCRN}</span> <span style="color: #660033;">-gt</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_YELLOW}</span>\][scr:<span style="color: #007800;">${DTCHSCRN}</span>] &quot;</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># Backgrounded running jobs</span>
    <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">BKGJBS</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">jobs</span> <span style="color: #660033;">-r</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> <span style="color: #660033;">-l</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${BKGJBS}</span> <span style="color: #660033;">-gt</span> <span style="color: #000000;">2</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_RED}</span>\][bg:<span style="color: #007800;">${BKGJBS}</span>]&quot;</span>
    <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${BKGJBS}</span> <span style="color: #660033;">-gt</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_YELLOW}</span>\][bg:<span style="color: #007800;">${BKGJBS}</span>] &quot;</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># Stopped Jobs</span>
    <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">STPJBS</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">jobs</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> <span style="color: #660033;">-l</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${STPJBS}</span> <span style="color: #660033;">-gt</span> <span style="color: #000000;">2</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_RED}</span>\][stp:<span style="color: #007800;">${STPJBS}</span>]&quot;</span>
    <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${STPJBS}</span> <span style="color: #660033;">-gt</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_YELLOW}</span>\][stp:<span style="color: #007800;">${STPJBS}</span>] &quot;</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># Bracket {</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${UID}</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>              
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${USER}</span>&quot;</span> == <span style="color: #ff0000;">&quot;<span style="color: #007800;">${LOGNAME}</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> 
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${SUDO_USER}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_RED}</span>\]&quot;</span>
            <span style="color: #000000; font-weight: bold;">else</span>
                <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_LIGHTRED}</span>\]&quot;</span>
            <span style="color: #000000; font-weight: bold;">fi</span>
        <span style="color: #000000; font-weight: bold;">else</span>                               
            <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_YELLOW}</span>\]&quot;</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">else</span>                                 
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${USER}</span>&quot;</span> == <span style="color: #ff0000;">&quot;<span style="color: #007800;">${LOGNAME}</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> 
            <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_GREEN}</span>\]&quot;</span>
        <span style="color: #000000; font-weight: bold;">else</span>                               
            <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_BROWN}</span>\]&quot;</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>{ &quot;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># Working directory</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-w</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${PWD}</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> 
        <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_GREEN}</span>\]<span style="color: #007800;">$(prompt_workingdir)</span>&quot;</span>
    <span style="color: #000000; font-weight: bold;">else</span>                                 
        <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_RED}</span>\]<span style="color: #007800;">$(prompt_workingdir)</span>&quot;</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># Closing bracket } and $\#</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${UID}</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>              
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${USER}</span>&quot;</span> == <span style="color: #ff0000;">&quot;<span style="color: #007800;">${LOGNAME}</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> 
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${SUDO_USER}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_RED}</span>\]&quot;</span>
            <span style="color: #000000; font-weight: bold;">else</span>
                <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_LIGHTRED}</span>\]&quot;</span>
            <span style="color: #000000; font-weight: bold;">fi</span>
        <span style="color: #000000; font-weight: bold;">else</span>                               
            <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_YELLOW}</span>\]&quot;</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">else</span>                                 
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${USER}</span>&quot;</span> == <span style="color: #ff0000;">&quot;<span style="color: #007800;">${LOGNAME}</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> 
            <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_GREEN}</span>\]&quot;</span>
        <span style="color: #000000; font-weight: bold;">else</span>                               
            <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span>\[<span style="color: #007800;">${COLOR_BROWN}</span>\]&quot;</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PS1}</span> }<span style="color: #000099; font-weight: bold;">\$</span>\[<span style="color: #007800;">${COLOR_DEFAULT}</span>\] &quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>     
&nbsp;
<span style="color: #666666; font-style: italic;"># Trim working dir to 1/4 the screen width</span>
<span style="color: #000000; font-weight: bold;">function</span> prompt_workingdir <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">pwdmaxlen</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$COLUMNS</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
  <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">trunc_symbol</span>=<span style="color: #ff0000;">&quot;...&quot;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$PWD</span> == <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">*</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #007800;">newPWD</span>=<span style="color: #ff0000;">&quot;~<span style="color: #007800;">${PWD#$HOME}</span>&quot;</span> 
  <span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #007800;">newPWD</span>=<span style="color: #800000;">${PWD}</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${#newPWD}</span> <span style="color: #660033;">-gt</span> <span style="color: #007800;">$pwdmaxlen</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">pwdoffset</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #800000;">${#newPWD}</span> - <span style="color: #007800;">$pwdmaxlen</span> + <span style="color: #000000;">3</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #007800;">newPWD</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${trunc_symbol}</span><span style="color: #007800;">${newPWD:$pwdoffset:$pwdmaxlen}</span>&quot;</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$newPWD</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Determine what prompt to display:</span>
<span style="color: #666666; font-style: italic;"># 1.  Display simple custom prompt for shell sessions started</span>
<span style="color: #666666; font-style: italic;">#     by script.  </span>
<span style="color: #666666; font-style: italic;"># 2.  Display &quot;bland&quot; prompt for shell sessions within emacs or </span>
<span style="color: #666666; font-style: italic;">#     xemacs.</span>
<span style="color: #666666; font-style: italic;"># 3   Display promptcmd for all other cases.</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> load_prompt <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #666666; font-style: italic;"># Get PIDs</span>
    <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">parent_process</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$PPID</span><span style="color: #000000; font-weight: bold;">/</span>cmdline <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span> \. <span style="color: #660033;">-f</span> <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">my_process</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$$</span><span style="color: #000000; font-weight: bold;">/</span>cmdline <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span> \. <span style="color: #660033;">-f</span> <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">if</span>  <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$parent_process</span> == script<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">PROMPT_COMMAND</span>=<span style="color: #ff0000;">&quot;&quot;</span>
        <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span> - \# - \u@\H { \w }<span style="color: #000099; font-weight: bold;">\$</span> &quot;</span>
    <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$parent_process</span> == emacs<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #007800;">$parent_process</span> == xemacs<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">PROMPT_COMMAND</span>=<span style="color: #ff0000;">&quot;&quot;</span>
        <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;\u@\h { \w }<span style="color: #000099; font-weight: bold;">\$</span> &quot;</span>
    <span style="color: #000000; font-weight: bold;">else</span>
        <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">DAY</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>A<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #007800;">PROMPT_COMMAND</span>=promptcmd
     <span style="color: #000000; font-weight: bold;">fi</span> 
    <span style="color: #7a0874; font-weight: bold;">export</span> PS1 PROMPT_COMMAND
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
load_prompt</pre></div></div>

<h3>Bonus &#8211; Finding the Right Colors</h3>
<p>As you may have noticed, most of these prompts use color, and the color is often represented in a coded form like <em>&#8216;\033[1;30m&#8217;</em>, which is quite difficult to read or remember.  An easy way to see all your available colors, and preview what they&#8217;ll look like, is to simply paste the following snippet into your browser:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">seq</span> <span style="color: #000000;">1</span> <span style="color: #000000;">7</span> ; <span style="color: #c20cb9; font-weight: bold;">seq</span> <span style="color: #000000;">30</span> <span style="color: #000000;">48</span> ; <span style="color: #c20cb9; font-weight: bold;">seq</span> <span style="color: #000000;">90</span> <span style="color: #000000;">107</span> <span style="color: #000000; font-weight: bold;">`</span> ; <span style="color: #000000; font-weight: bold;">do</span> 
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;\e[<span style="color: #007800;">${i}</span>mtest\e[0m<span style="color: #007800;">$i</span>&quot;</span> 
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>Which will output each color code with its number.</p>
<p><img src="http://imagecdn.maketecheasier.com/2011/09/morebashprompts-colortest.png" alt="morebashprompts-colortest" title="morebashprompts-colortest" width="506" height="291" class="aligncenter size-full wp-image-38537" /></p>
<h3>Conclusion</h3>
<p>There are, of course infinite variations that could be packed into your prompt.  Nearly any kind of textual data can be added in, and bash&#8217;s developers have had decades to add in functionality.  Some readers have even commented about running custom Python or Ruby scripts from within the prompt.  Whatever you do, make it functional, and if it&#8217;s REALLY cool, drop us a link in the comments!<br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://maketecheasier.com/write-linux-shell-scripts/2011/06/30' title='The Beginner Guide to Writing Linux Shell Scripts'>The Beginner Guide to Writing Linux Shell Scripts</a></li>
<li><a href='http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09' title='10 Useful Tools, Websites And Tricks to Help You Master Linux Command'>10 Useful Tools, Websites And Tricks to Help You Master Linux Command</a></li>
<li><a href='http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04' title='8 Useful and Interesting Bash Prompts'>8 Useful and Interesting Bash Prompts</a></li>
<li><a href='http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04' title='How to Get a Quake-style Drop-down Terminal in Linux'>How to Get a Quake-style Drop-down Terminal in Linux</a></li>
</ul>
<p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19&amp;title=More+Useful+and+Interesting+Bash+Prompts&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19">More Useful and Interesting Bash Prompts</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Beginner Guide to Writing Linux Shell Scripts</title>
		<link>http://maketecheasier.com/write-linux-shell-scripts/2011/06/30</link>
		<comments>http://maketecheasier.com/write-linux-shell-scripts/2011/06/30#comments</comments>
		<pubDate>Thu, 30 Jun 2011 14:58:29 +0000</pubDate>
		<dc:creator>Joshua Price</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://maketecheasier.com/?p=34658</guid>
		<description><![CDATA[For starters &#8211; let&#8217;s clarify that headline. Linux has more than one possible shell, and scripting any of them is a subject that can easily pack a full book. What we&#8217;re going to be doing is covering the basic elements of a bash script. If you don&#8217;t know what shell... <p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/write-linux-shell-scripts/2011/06/30&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/write-linux-shell-scripts/2011/06/30" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/write-linux-shell-scripts/2011/06/30" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/write-linux-shell-scripts/2011/06/30" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/write-linux-shell-scripts/2011/06/30&amp;title=The+Beginner+Guide+to+Writing+Linux+Shell+Scripts&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/write-linux-shell-scripts/2011/06/30" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/write-linux-shell-scripts/2011/06/30">The Beginner Guide to Writing Linux Shell Scripts</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></description>
			<content:encoded><![CDATA[<p><img src="http://imagecdn.maketecheasier.com/2011/06/bashscripting-small.png" alt="bashscripting-small" title="bashscripting-small" width="200" height="150" class="alignleft size-full wp-image-34667" />For starters &#8211; let&#8217;s clarify that headline. Linux has more than one possible shell, and scripting any of them is a subject that can easily pack a full book. What we&#8217;re going to be doing is covering the basic elements of a <em>bash</em> script. If you don&#8217;t know what shell you&#8217;re using, it&#8217;s probably <em>bash</em>. The process will be familiar to anyone who&#8217;s worked with DOS&#8217;s <em>bat</em> files, it&#8217;s essentially the same concept. You just put a series of commands into a text file and run it. The difference comes from the fact that bash scripts can do a LOT more than batch files. In fact, bash scripting isn&#8217;t all that far from a full-fledged language like Python. Today we&#8217;ll be covering a few basics like input, output, arguments and variables.<br />
<span id="more-34658"></span><br />
<strong>Note</strong>: <em>If we want to get really technical, bash is not a Linux-only shell.  Much (though possibly not all) of the following would apply to any UNIX-type system, including Mac OSX and the BSDs.</em></p>
<h2>Hello World</h2>
<p>It&#8217;s tradition to begin a new &#8220;language&#8221; by creating a simple script to output the words &#8220;Hello World!&#8221;. That&#8217;s easy enough, just open your favorite text editor and enter the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> Hello World<span style="color: #000000; font-weight: bold;">!</span></pre></div></div>

<p>With only two lines, it couldn&#8217;t be a whole lot simpler, but that first line, <em>#!/bin/bash</em>, may not be immediately obvious. The first two characters (often called a hashbang) are a special signal. It tells Linux that this script should be run through the /bin/bash shell, as opposed to the C shell or Korn shell or anything else you might have installed. Without it, there&#8217;s no easy way for Linux to tell exactly what type of shell script this is. A Python script, for example, would likely start with something like <em>#!/usr/bin/python</em>.  </p>
<p>After that is just the <em>echo</em> statement, which prints the words after it to the terminal (technically, to <em>standard output</em>).  </p>
<h2>Running Your Script</h2>
<p>As is often the case with Linux, there are multiple ways to do this job. The most basic way would be to call bash manually and feed it the script file, as in</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#Filename can be anything, .sh is a common practice for shell scripts.</span>
<span style="color: #c20cb9; font-weight: bold;">bash</span> myscript.sh</pre></div></div>

<p><img src="http://imagecdn.maketecheasier.com/2011/06/bashscripting-hello1.png" alt="bashscripting-hello1" title="bashscripting-hello1" width="246" height="66" class="aligncenter size-full wp-image-34660" /></p>
<p>Clever readers may be thinking &#8220;<em>But wait, didn&#8217;t we put that hashbang thing in so it would know to use bash?  Why did I have to run bash manually?</em>&#8221; and the answer is &#8220;<em>You didn&#8217;t</em>&#8220;. At least, you wouldn&#8217;t have if we had taken a moment to make the script executable on its own.  </p>
<p>In the previous example, we launched bash and sent it the script. Now we&#8217;ll save ourselves some future time by making the script executable so we dont need to run bash manually. That&#8217;s as easy as a single command.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> +x myscript.sh</pre></div></div>

<p>And now it can be run with the filename directly.  </p>
<p><img src="http://imagecdn.maketecheasier.com/2011/06/bashscripting-hello2.png" alt="bashscripting-hello2" title="bashscripting-hello2" width="243" height="109" class="aligncenter size-full wp-image-34661" /></p>
<h2>Variables and Arguments</h2>
<p>Variables in bash can be a little more confusing than some other scripting languages, partly because they sometimes need to be prefaced with a <em>$</em> character and sometimes not &#8211; depending on what you&#8217;re doing.  Take the following example.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PATH</span>=<span style="color: #007800;">$PATH</span>:<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>josh<span style="color: #000000; font-weight: bold;">/</span>scripts</pre></div></div>

<p>We refer to the same variable, PATH, two times. Once there&#8217;s no <em>$</em>, but the other time there is.  There are a few ways that you can remember when a $ is appropriate, but this author uses a &#8220;talking&#8221; metaphor. If I&#8217;m talking TO the variable (such as assigning it a new value) I call it by the short name, in this case PATH. If I&#8217;m talking ABOUT a variable (such as getting its current value) it gets a more formal title ($PATH). The precise reasoning and inner workings of this design are beyond the scope of this guide, so just try to remember that you need to include a $ if you&#8217;re trying to fetch the information in a variable.  </p>
<p>Now we&#8217;re going to use a variable in our script. Change the second line to look like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> Hello <span style="color: #007800;">$1</span><span style="color: #000000; font-weight: bold;">!</span></pre></div></div>

<p>And re-run your script, but this time include your name after the script name.  </p>
<p><img src="http://imagecdn.maketecheasier.com/2011/06/bashscripting-arg1.png" alt="bashscripting-arg1" title="bashscripting-arg1" width="232" height="59" class="aligncenter size-full wp-image-34662" /></p>
<p>Bash auto-assigns certain variables for you, including a few such as $1, $2 etc which hold each of the arguments passed to the script. Variables can be reassigned and renamed any way you wish, so you could rewrite the previous script as</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #007800;">firstname</span>=<span style="color: #007800;">$1</span>
<span style="color: #007800;">lastname</span>=<span style="color: #007800;">$2</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> Hello <span style="color: #007800;">$firstname</span> <span style="color: #007800;">$lastname</span><span style="color: #000000; font-weight: bold;">!</span></pre></div></div>

<p>As you can see, there are no $ signs when assigning the value to the variable, but you do need them when pulling the info out.  </p>
<h2>Conditionals and Loops</h2>
<p>No script could get very far without the ability to analyse or loop through data. The most common method of determining a course of action is to use the if statement. It works much like you&#8217;d expect &#8211; IF something THEN do stuff ELSE do something different. This example compares the string of characters that we stored in the variable <em>firstname</em> and compares it to some hardcoded text. If they match, it prints special output.  Otherwise, it continues as normal.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #007800;">firstname</span>=<span style="color: #007800;">$1</span>
<span style="color: #007800;">lastname</span>=<span style="color: #007800;">$2</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$firstname</span>&quot;</span> == <span style="color: #ff0000;">&quot;Josh&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;What a great name&quot;</span>
<span style="color: #000000; font-weight: bold;">else</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> Hello <span style="color: #007800;">$firstname</span> <span style="color: #007800;">$lastname</span><span style="color: #000000; font-weight: bold;">!</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>Finally, the next core component is bash&#8217;s ability to loop over data. The normal looping mechanisms for bash are FOR, WHILE, and UNTIL. We&#8217;ll start with while, as it&#8217;s the simplest.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash </span>
         <span style="color: #007800;">counter</span>=<span style="color: #000000;">0</span>
         <span style="color: #666666; font-style: italic;">#While the counter is less than 10, keep looping</span>
         <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>  <span style="color: #007800;">$counter</span> <span style="color: #660033;">-lt</span> <span style="color: #000000;">50</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">do</span>
             <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$counter</span>
             <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #007800;">counter</span>=counter+<span style="color: #000000;">1</span> 
         <span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>That example creates a <em>counter</em> variable, begins a <em>while</em> loop, and continues looping (and adding one to the counter) until it reaches the limit, in this case 50. Anything after the <em>done</em> statement will execute once the loop is complete.  </p>
<p>UNTIL operates similarly, but as the reverse of WHILE. A while loop will continue as long as its expression is true (counter less than 50). The until loop takes the opposite approach, and would be written as</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">until</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>  <span style="color: #007800;">$counter</span> <span style="color: #660033;">-gt</span> <span style="color: #000000;">50</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">do</span></pre></div></div>

<p>In this example, &#8220;while less than 50&#8243; and &#8220;until greater than 50&#8243; will have nearly identical results (the difference being that one will include the number 50 itself, and the other will not. Try it out for yourself to see which one, and why.)</p>
<h2>Conclusion</h2>
<p>As stated above, it would take a lot more than a single Getting Started article to fully demonstrate the power of bash scripting. The pieces shown here can be seen as the core components of how bash operates, and should suffice to show you the basic principles behind shell scripting in Linux. If you really want to get into the guts and start making some great scripts, check out GNU&#8217;s official bash reference guide <a href="http://www.gnu.org/software/bash/manual/bashref.html">here</a>. Happy scripting!<br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04' title='8 Useful and Interesting Bash Prompts'>8 Useful and Interesting Bash Prompts</a></li>
<li><a href='http://maketecheasier.com/mastering-the-bash-history/2009/05/20' title='Mastering the Bash History'>Mastering the Bash History</a></li>
<li><a href='http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19' title='Making The Linux Command Line A Little Friendlier'>Making The Linux Command Line A Little Friendlier</a></li>
<li><a href='http://maketecheasier.com/more-useful-and-interesting-bash-prompts/2011/09/19' title='More Useful and Interesting Bash Prompts'>More Useful and Interesting Bash Prompts</a></li>
</ul>
<p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/write-linux-shell-scripts/2011/06/30&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/write-linux-shell-scripts/2011/06/30" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/write-linux-shell-scripts/2011/06/30" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/write-linux-shell-scripts/2011/06/30" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/write-linux-shell-scripts/2011/06/30&amp;title=The+Beginner+Guide+to+Writing+Linux+Shell+Scripts&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/write-linux-shell-scripts/2011/06/30" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/write-linux-shell-scripts/2011/06/30">The Beginner Guide to Writing Linux Shell Scripts</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://maketecheasier.com/write-linux-shell-scripts/2011/06/30/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to Manage Ruby Installations Easily with RVM</title>
		<link>http://maketecheasier.com/manage-ruby-installations-easily-with-rvm/2011/02/22</link>
		<comments>http://maketecheasier.com/manage-ruby-installations-easily-with-rvm/2011/02/22#comments</comments>
		<pubDate>Tue, 22 Feb 2011 12:58:36 +0000</pubDate>
		<dc:creator>Joshua Price</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rvm]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://maketecheasier.com/?p=29805</guid>
		<description><![CDATA[Those unfamiliar with software development may be surprised at how many so-called grey areas there can be. Even if you know you want to write, say, a Rails app, you&#8217;ve got several more specific decisions to make. What database should you use? Which version of Ruby? Which gems should be... <p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/manage-ruby-installations-easily-with-rvm/2011/02/22&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/manage-ruby-installations-easily-with-rvm/2011/02/22" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/manage-ruby-installations-easily-with-rvm/2011/02/22" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/manage-ruby-installations-easily-with-rvm/2011/02/22" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/manage-ruby-installations-easily-with-rvm/2011/02/22&amp;title=How+to+Manage+Ruby+Installations+Easily+with+RVM&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/manage-ruby-installations-easily-with-rvm/2011/02/22" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/manage-ruby-installations-easily-with-rvm/2011/02/22">How to Manage Ruby Installations Easily with RVM</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></description>
			<content:encoded><![CDATA[<p><img src="http://imagecdn.maketecheasier.com/2011/02/rvm-logo.png" alt="rvm-logo" title="rvm-logo" width="200" height="195" class="alignleft size-full wp-image-29811" />Those unfamiliar with software development may be surprised at how many so-called grey areas there can be. Even if you know you want to write, say, a Rails app, you&#8217;ve got several more specific decisions to make. What database should you use? Which version of Ruby? Which gems should be installed? Will it conflict with any other Ruby versions or gem sets? RVM, the Ruby Version Manager, can take care of that. RVM allows you to install, manage, and switch between Ruby versions on the fly so you can develop and test software in multiple Ruby versions with no hassle. This guide will show you how to install RVM on Ubuntu and use it to manage your Ruby environment.<br />
<span id="more-29805"></span><br />
<strong>Note</strong>:  <em>This is not a &#8220;How To Code Ruby&#8221; article, it deals only with using RVM to manage your Ruby installations.</em>  </p>
<h3>How it Works</h3>
<p>The most common RVM setup goes something like this &#8211; A user installs RVM as an application, either system-wide or within their home. Through RVM, the user&#8217;s chosen Ruby versions are installed automatically into that user&#8217;s home. Using RVM commands, the user specifies which version they&#8217;d like to have active at any given time. All calls made to Ruby during that time are routed to the appropriate Ruby executable and run as normal. There&#8217;s no virtualization or complex wrappers or chroots to worry about, it acts more-or-less like a clever series of symlinks and environment variables that direct all Ruby calls to the chosen version.  </p>
<h3>Installation</h3>
<p>First we need a few prerequisites. Your standard Ubuntu installation should contain much of what&#8217;s needed, but some needed packages may be missing. To build RVM properly, install the following packages from Ubuntu Software Center or from the command line with:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">git</span> build-essential <span style="color: #c20cb9; font-weight: bold;">bison</span> openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-<span style="color: #000000;">0</span> libsqlite3-dev sqlite3 libxml2-dev libxslt-dev <span style="color: #c20cb9; font-weight: bold;">autoconf</span> libc6-dev</pre></div></div>

<p>This readies our system to properly build and install RVM and Ruby. We won&#8217;t need to do the usual configure/make routine on this one as RVM actually includes a simple build script which should do the work for you. Once all the above dependencies are installed, run the following from the command line:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> curl http:<span style="color: #000000; font-weight: bold;">//</span>rvm.beginrescueend.com<span style="color: #000000; font-weight: bold;">/</span>releases<span style="color: #000000; font-weight: bold;">/</span>rvm-install-head <span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>This will fetch the source and deliver a nice message from RVM&#8217;s developer.</p>
<p><img src="http://imagecdn.maketecheasier.com/2011/02/rvm-installationscript.png" alt="rvm-installationscript" title="rvm-installationscript" width="568" height="369" class="aligncenter size-full wp-image-29806" /></p>
<h3>Adding a Ruby Version</h3>
<p>At this point you&#8217;ve got RVM but no usable Ruby install to run with it. Getting RVM to install one is as simple as a single shell command. For the first example, we&#8217;ll install the 1.8.7 stable version from source with one RVM command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rvm <span style="color: #c20cb9; font-weight: bold;">install</span> 1.8.7</pre></div></div>

<p><img src="http://imagecdn.maketecheasier.com/2011/02/rvm-install187.png" alt="rvm-install187" title="rvm-install187" width="545" height="307" class="aligncenter size-full wp-image-29807" /></p>
<p>RVM will handle the entire process including configuration, compilation and the installation of RubyGems.  </p>
<p><img src="http://imagecdn.maketecheasier.com/2011/02/rvm-install187-2.png" alt="rvm-install187-2" title="rvm-install187-2" width="573" height="366" class="aligncenter size-full wp-image-29808" /></p>
<h3>Post-Install</h3>
<p>Once complete, there&#8217;s a little bit of environment setup we&#8217;ve got to do. For RVM to be able to properly intercept Ruby calls, we&#8217;ve got to add the following line to <em>.bashrc</em> or <em>.bash_profile</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-s</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$HOME</span>/.rvm/scripts/rvm&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> . <span style="color: #ff0000;">&quot;<span style="color: #007800;">$HOME</span>/.rvm/scripts/rvm&quot;</span></pre></div></div>

<p><strong>Restart your shell</strong> and it should take effect. To test, just enter</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">type</span> rvm <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">head</span> <span style="color: #660033;">-1</span></pre></div></div>

<p>Which should respond with <em>&#8220;rvm is a function&#8221;</em>.  If not, something&#8217;s broken along the line.  </p>
<h3>Managing Ruby Versions</h3>
<p>Now that everything is set up, we can actually use RVM!  Assuming you&#8217;ve installed version 1.8.7 as in the example above, it can be selected with</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rvm use 1.8.7</pre></div></div>

<p>RVM should give you a response confirming your choice and showing you the location of the Ruby executable. This can be verified later using the standard system which command.  </p>
<p><img src="http://imagecdn.maketecheasier.com/2011/02/rvm-switch.png" alt="rvm-switch" title="rvm-switch" width="485" height="146" class="aligncenter size-full wp-image-29809" /></p>
<p>Additional versions can be installed the same way, and gems can be added and removed from RVM versions exactly as they would in a normal system Ruby install. You can pick your version on the fly to be sure your app works as intended without ever worrying about conflicts and environment mismatches. Enjoy!<br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://maketecheasier.com/integrate-skype-with-ubuntu-unity/2012/05/23' title='How to Integrate Skype With Ubuntu Unity'>How to Integrate Skype With Ubuntu Unity</a></li>
<li><a href='http://maketecheasier.com/install-java-runtime-in-ubuntu/2012/05/14' title='How to Install Java Runtime In Ubuntu 12.04'>How to Install Java Runtime In Ubuntu 12.04</a></li>
<li><a href='http://maketecheasier.com/connect-to-a-vpn-in-ubuntu/2012/05/07' title='How to Connect to A VPN In Ubuntu [Quick Tips]'>How to Connect to A VPN In Ubuntu [Quick Tips]</a></li>
<li><a href='http://maketecheasier.com/upgrade-to-gimp-2-8-in-ubuntu/2012/05/04' title='How to Upgrade to Gimp 2.8 in Ubuntu'>How to Upgrade to Gimp 2.8 in Ubuntu</a></li>
</ul>
<p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/manage-ruby-installations-easily-with-rvm/2011/02/22&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/manage-ruby-installations-easily-with-rvm/2011/02/22" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/manage-ruby-installations-easily-with-rvm/2011/02/22" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/manage-ruby-installations-easily-with-rvm/2011/02/22" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/manage-ruby-installations-easily-with-rvm/2011/02/22&amp;title=How+to+Manage+Ruby+Installations+Easily+with+RVM&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/manage-ruby-installations-easily-with-rvm/2011/02/22" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/manage-ruby-installations-easily-with-rvm/2011/02/22">How to Manage Ruby Installations Easily with RVM</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://maketecheasier.com/manage-ruby-installations-easily-with-rvm/2011/02/22/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Supercharge Your Shell with Bashish [Linux]</title>
		<link>http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27</link>
		<comments>http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27#comments</comments>
		<pubDate>Thu, 27 Jan 2011 12:58:38 +0000</pubDate>
		<dc:creator>Joshua Price</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://maketecheasier.com/?p=28352</guid>
		<description><![CDATA[If you&#8217;re a Linux (or even Mac) user, and you&#8217;ve never toyed with your shell prompt, you might not realize just how useful a good prompt can be. Sure, it can show your user and host names, and perhaps the current directory, but a really good prompt can do a... <p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27&amp;title=How+to+Supercharge+Your+Shell+with+Bashish+%5BLinux%5D&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27">How to Supercharge Your Shell with Bashish [Linux]</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></description>
			<content:encoded><![CDATA[<p><img src="http://imagecdn.maketecheasier.com/2011/01/bashish-lcars-small.png" alt="bashish-lcars-small" title="bashish-lcars-small" width="220" height="149" class="alignleft size-full wp-image-28353" />If you&#8217;re a Linux (or even Mac) user, and you&#8217;ve never toyed with your shell prompt, you might not realize just how useful a good prompt can be. Sure, it can show your user and host names, and perhaps the current directory, but a really good prompt can do a <a href="http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04">whole lot more</a>. Those who spend a LOT of time in the terminal might even want to take it a step further and move into a custom semi-graphical shell with all kinds of bells and whistles. If you&#8217;re one such shell enthusiast, then check out <a href="http://bashish.sourceforge.net/" target="_blank">Bashish</a> &#8211; a way to theme your command prompt. Yep, you read that right.<br />
<span id="more-28352"></span></p>
<h3>Installing Bashish</h3>
<p>Not all the links on the Bashish <a href="http://bashish.sourceforge.net/download.html">Download Page</a> seem to be working, however the source tarball is working fine. Once extracted, it can be installed from the command line with</p>
<pre lang="bash">./configure &#038;&#038; make &#038;&#038; sudo make install</pre>
<p>If you need details on the above steps, see <a href="http://maketecheasier.com/install-software-from-a-tarball-in-linux/2009/06/25">How to Install Software from a Tarball in Linux</a>.  </p>
<p>You&#8217;ll need to restart your shell for Bashish to take effect.  </p>
<h3>Choosing Themes</h3>
<p>Bashish comes with several themes in the base package, and you can list them with the command </p>
<pre lang="bash">bashish list</pre>
<p><img src="http://imagecdn.maketecheasier.com/2011/01/bashish-list.png" alt="bashish-list" title="bashish-list" width="418" height="328" class="aligncenter size-full wp-image-28357" /></p>
<p>And once you&#8217;ve seen a theme you&#8217;d like to try, just enter</p>
<pre lang="bash">bashish (theme name)</pre>
<p>There is an alternate method, which will allow you to browse the themes instead of specifying one-at-a-time, but in the tests performed for this article, the theme manager failed to apply changes to theme selection, so the above method is recommended. Should you wish to try the theme manager, it can be run with the command <code>bashishtheme</code> and requires the <em>dialog</em> program in order to run properly.  </p>
<h3>Disabling Bashish</h3>
<p>There are some cases in which Bashish might cause problems with software run through it, so the developers have included a fairly simple way to temporarily suspend Bashish for the duration of a process. To run a command without Bashish, run it as </p>
<pre lang="bash">BASHISH_DISABLED=1 your_command</pre>
<h3>Recommended Themes</h3>
<p>Of the themes included with Bashish, there are a few that stand out as especially cool (at least in this author&#8217;s opinion). The following themes are the ones we&#8217;d most recommend, either for usefulness or simply because of the cool factor.  </p>
<p>The <em>Box</em> theme applies a border around each section of your output, marking a clear distinction between events.  </p>
<p><img src="http://imagecdn.maketecheasier.com/2011/01/bashish-box2.png" alt="bashish-box2" title="bashish-box2" width="412" height="251" class="aligncenter size-full wp-image-28360" /></p>
<p>The <em>Bashish2</em> theme is an elegant 2-liner with some minimal information.</p>
<p><img src="http://imagecdn.maketecheasier.com/2011/01/bashish-bashish2.png" alt="bashish-bashish2" title="bashish-bashish2" width="412" height="173" class="aligncenter size-full wp-image-28363" /></p>
<p>The default theme <em>BlueSteel</em>, and with good reason. It looks lovely and contains several bits of useful info.  </p>
<p><img src="http://imagecdn.maketecheasier.com/2011/01/bashish-bluesteel.png" alt="bashish-bluesteel" title="bashish-bluesteel" width="412" height="147" class="aligncenter size-full wp-image-28364" /></p>
<p><em>Elite</em> and <em>Elite2</em> are favorites as well, because they pack a lot of info into a small space, and include bash history number in the top line.  </p>
<p><img src="http://imagecdn.maketecheasier.com/2011/01/bashish-elite2.png" alt="bashish-elite2" title="bashish-elite2" width="412" height="152" class="aligncenter size-full wp-image-28365" /></p>
<p>The <em>LCARS</em> theme is clearly more about style than substance, as it&#8217;s intended to resemble the LCARS computer interface seen on several Star Trek series. It doesn&#8217;t give much in the ways of useful info, and it takes up a lot of space, but it deserves a mention.  </p>
<p><img src="http://imagecdn.maketecheasier.com/2011/01/bashish-lcars-large.png" alt="bashish-lcars-large" title="bashish-lcars-large" width="412" height="256" class="aligncenter size-full wp-image-28366" /></p>
<p>Finally, for those who want a clear visual split between commands, but not a bunch of text in the way, we&#8217;ve got the simplistic <em>Uberprompt</em>.</p>
<p><img src="http://imagecdn.maketecheasier.com/2011/01/bashish-uber.png" alt="ashish-uber" title="bashish-uber" width="412" height="143" class="aligncenter size-full wp-image-28367" /></p>
<h3>Conclusion</h3>
<p>If you want a fancy shell without trying to decode a line like <em>PS1=&#8221;\[\033[35m\]\t\[\033[m\]-\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ &#8220;</em> to do it, Bashish is a great way to go. There are enough built-in themes to satisfy just about anyone, and for the most part, they look great. This author will probably be using BlueSteel for quite a while.  </p>
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04' title='8 Useful and Interesting Bash Prompts'>8 Useful and Interesting Bash Prompts</a></li>
<li><a href='http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19' title='Making The Linux Command Line A Little Friendlier'>Making The Linux Command Line A Little Friendlier</a></li>
<li><a href='http://maketecheasier.com/write-linux-shell-scripts/2011/06/30' title='The Beginner Guide to Writing Linux Shell Scripts'>The Beginner Guide to Writing Linux Shell Scripts</a></li>
<li><a href='http://maketecheasier.com/multitask-at-linux-command-line/2011/04/28' title='How to Multitask at the Linux Command Line with Screen'>How to Multitask at the Linux Command Line with Screen</a></li>
</ul>
<p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27&amp;title=How+to+Supercharge+Your+Shell+with+Bashish+%5BLinux%5D&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27">How to Supercharge Your Shell with Bashish [Linux]</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>10 Useful Tools, Websites And Tricks to Help You Master Linux Command</title>
		<link>http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09</link>
		<comments>http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09#comments</comments>
		<pubDate>Tue, 09 Nov 2010 22:00:11 +0000</pubDate>
		<dc:creator>Damien</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://maketecheasier.com/?p=23608</guid>
		<description><![CDATA[When it comes to Linux command, it is always a love and hate affair. Newbies tend to shun away from the command line as much as possible while the intermediate to expert users who are used to it will swear by it, and boost how much faster and more productive... <p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09&amp;title=10+Useful+Tools%2C+Websites+And+Tricks+to+Help+You+Master+Linux+Command&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09">10 Useful Tools, Websites And Tricks to Help You Master Linux Command</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></description>
			<content:encoded><![CDATA[<p><img src="http://imagecdn.maketecheasier.com/2010/11/lcommand-main.jpg" alt="lcommand-main" title="lcommand-main" width="200" height="167" class="alignleft size-full wp-image-24178" />When it comes to Linux command, it is always a love and hate affair. Newbies tend to shun away from the command line as much as possible while the intermediate to expert users who are used to it will swear by it, and boost how much faster and more productive they have become due to the command line. </p>
<p>Regardless which camp you belong, as long as you are using Linux (doesn&#8217;t matter which distro), you are sure to hit the terminal and type some commands into it at some point of time. Why not embrace it and take the opportunity to learn something new?</p>
<p>Here are some websites, tools and tricks that you can make use of to learn Linux command line. This is in no way a comprehensive list, but will be a good start for those who wish to get started.<br />
<span id="more-23608"></span><br />
<strong>Note</strong>: <em>The &#8220;command line&#8221; stated here can refer to the bash commands you type in the terminal, or writing your own bash scripts.</em><br />
<!--more--> </p>
<h3>Website</h3>
<h4>1. Linux Command.org</h4>
<p>LinuxCommand.org is a site on&#8230; you guess it, Linux command. If you know absolutely nothing about the command line, this is a good starting ground. LinuxCommand is more like a school, where it teaches you from the basic, such as &#8220;<em>what is a shell?</em>&#8221; to simple command usage and lastly, advanced techniques like &#8220;<em>how to write your own shell scripts</em>&#8220;.</p>
<p><a href="http://linuxcommand.org" target="_blank" >http://linuxcommand.org</a></p>
<h4>2. CommandLineFu</h4>
<p>There are often cases when you want to get things done on the terminal, but can&#8217;t remember the exact code. When such cases occur, a good place to check out is CommandLineFu. Just think of a social network for command line and you get CommandLineFu. CommandlineFu is the place where people share the commonly used bash code so you just have to copy/paste the code to the terminal instead of writing your own. It is also a great way to discover the infinite possibilities that you can do on the terminal.</p>
<p><a href="http://www.commandlinefu.com/" target="_blank" >CommandlineFu</a></p>
<h4>3. ShellFu</h4>
<p>Similar to CommandlineFu, ShellFu is also a place where you can find plenty of codes, examples and uses of the command line. What makes it different is that ShellFu is more like a blog (rather than a social network), is moderated and there is no vote up/down feature. </p>
<p><a href="http://www.shell-fu.org/lister.php" target="_blank" >ShellFu</a></p>
<h4>4. O&#8217;Reilly Linux Command and SS64</h4>
<p>O&#8217;Reilly Linux Command and SS64 bash are both a good place to go if you need just a quick reference of a particular command. All the commands are sorted in alphabetical order, so you can easily find the commands you want.</p>
<p><a href="http://www.oreillynet.com/linux/cmd/" target="_blank" >O&#8217;Reilly Linux Command</a><br />
<a href="http://ss64.com/bash/" target="_blank" >SS64</a></p>
<h3>Tools</h3>
<h4>5. CLI Companion</h4>
<p>CLI Companion is a replacement for your default terminal. It is divided into two panes. The upper pane is a library of the commonly used bash command and the lower pane is the actual terminal. You can scroll through the library to find the command you want, right click on it and select &#8220;Apply&#8221;. The command will get executed in the terminal below.</p>
<p><img src="http://imagecdn.maketecheasier.com/2010/11/lcommand-clicompanion.png" alt="lcommand-clicompanion" title="lcommand-clicompanion" width="577" height="447" class="aligncenter size-full wp-image-24173" /></p>
<p>In Ubuntu, you can install via the command:<br />
<pre lang="bash">sudo add-apt-repository ppa:clicompanion-devs/clicompanion-nightlies<br />
sudo apt-get update<br />
sudo apt-get install clicompanion</pre></p>
<h4>6. Ebook &#8211; Bash Guide For Beginners</h3>
<p>For beginners who like to learn bash command on the move, a good way is to download the free ebook &#8211; <strong>Bash Guide For Beginners</strong> and read it on your mobile devices. The ebook contains (almost) every single things you need to know about bash command. Even if you are experience with bash command, it never hurts to have a ebook by your side where you can refer from time to time.</p>
<p><a href="http://maketecheasier.tradepub.com/free/w_mach02" target="_blank" >Bash Guide For Beginners</a></p>
<h3>Tricks</h3>
<p>Here are some tricks that you can use to increase your productivity.</p>
<h4>7. Bash Autocompletion</h4>
<p>One easy way to get around bash is to use the autocompletion feature. When you are halfway through typing a command, you just have to press the &#8220;Tab&#8221; button on your keyboard and it will autocomplete your command for you. If it can&#8217;t understand your command, it will show a list of options for you to choose.  </p>
<p><img src="http://imagecdn.maketecheasier.com/2010/11/lcommand-autocomplete.png" alt="lcommand-autocomplete" title="lcommand-autocomplete" width="448" height="183" class="aligncenter size-full wp-image-24174" /></p>
<h4>8. Creating alias</h4>
<p>If you frequently use the same command over and over again, it is a good idea to add an alias for that command. An alias is just a short for a (long) command. You can use aliases for a variety of reasons, such as shortening a long command or making the Linux shell act more like a Windows/Mac/Solaris/BSD/Whatever shell. </p>
<p><img src="http://imagecdn.maketecheasier.com/2010/11/lcommand-alias.png" alt="lcommand-alias" title="lcommand-alias" width="578" height="156" class="aligncenter size-full wp-image-24176" /></p>
<p><a href="http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19#alias">Creating bash alias</a></p>
<h4>9. Mastering the bash history</h4>
<p>The bash history contains the list of the commands that you have used before. To access your bash history, the simplest way is to use the Up/Down arrow key in the terminal. More bash history tricks can be found at the link below.</p>
<p><a href="http://maketecheasier.com/mastering-the-bash-history/2009/05/20" target="_blank" >Mastering bash history</a></p>
<h4>10. Using of bash prompt</h4>
<p>Bash prompt is the result that appears when you enter a bash command. Most people are using the default system setting (gray color), not knowing that they can change the prompt settings and get it to display additional information and colors. </p>
<p><a href="http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04" target="_blank">bash prompt</a></p>
<p>As I said above, this is by no means the most comprehensive list around and I am sure there are plenty of other useful websites, tools and tricks that I have left out. Do tell us about it in the comments.<br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://maketecheasier.com/knowing-linux-system-via-the-command-line/2012/02/23' title='Knowing Your Linux System Via the Command Line'>Knowing Your Linux System Via the Command Line</a></li>
<li><a href='http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04' title='How to Get a Quake-style Drop-down Terminal in Linux'>How to Get a Quake-style Drop-down Terminal in Linux</a></li>
<li><a href='http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19' title='Making The Linux Command Line A Little Friendlier'>Making The Linux Command Line A Little Friendlier</a></li>
<li><a href='http://maketecheasier.com/10-more-funny-andor-useless-linux-commands/2012/05/10' title='10 More Funny and/or Useless Linux Commands'>10 More Funny and/or Useless Linux Commands</a></li>
</ul>
<p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09&amp;title=10+Useful+Tools%2C+Websites+And+Tricks+to+Help+You+Master+Linux+Command&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09">10 Useful Tools, Websites And Tricks to Help You Master Linux Command</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Save and Share Bash Settings Using Pastebin</title>
		<link>http://maketecheasier.com/save-share-bash-settings-using-pastebin/2010/01/05</link>
		<comments>http://maketecheasier.com/save-share-bash-settings-using-pastebin/2010/01/05#comments</comments>
		<pubDate>Tue, 05 Jan 2010 23:00:19 +0000</pubDate>
		<dc:creator>Joshua Price</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bashrc]]></category>
		<category><![CDATA[pastebin]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://maketecheasier.com/?p=10525</guid>
		<description><![CDATA[As someone who earns part of my living by trying out Linux distros, I reinstall a LOT. Even my favorites rarely last longer than a few months before they&#8217;re wiped away to make room for something new. Invariably, one of the very first things I do after any installation is... <p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/save-share-bash-settings-using-pastebin/2010/01/05&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/save-share-bash-settings-using-pastebin/2010/01/05" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/save-share-bash-settings-using-pastebin/2010/01/05" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/save-share-bash-settings-using-pastebin/2010/01/05" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/save-share-bash-settings-using-pastebin/2010/01/05&amp;title=How+to+Save+and+Share+Bash+Settings+Using+Pastebin&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/save-share-bash-settings-using-pastebin/2010/01/05" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/save-share-bash-settings-using-pastebin/2010/01/05">How to Save and Share Bash Settings Using Pastebin</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-10536" src="http://imagecdn.maketecheasier.com/2010/01/pastebin-terminalicon.png" alt="pastebin-terminalicon" width="128" height="128" />As someone who earns part of my living by trying out Linux distros, I reinstall a LOT. Even my favorites rarely last longer than a few months before they&#8217;re wiped away to make room for something new. Invariably, one of the very first things I do after any installation is to <a href="http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04">tweak my shell</a> to include a few options, aliases, and of course my preferred prompt.  After rebuilding my <em>.bashrc</em> file dozens of times, I began to think there had to be a better way. I began looking for a place online to store my .bashrc file, with all my settings exactly the way I want them. This proved more difficult than I had expected. To do this properly, I needed a website that was free, did not require registration, would hold my file permanently, allow unlimited public downloads, give it an URL I could remember, and allow me to make changes to the file without having to re-upload. This was a tall order, but <a href="http://pastebin.com/" target="_blank">Pastebin.com</a> fit the bill.<br />
<span id="more-10525"></span></p>
<h3>Pastebin 101</h3>
<p>For those who&#8217;ve never used pastebin, it&#8217;s a very simple service. You enter in some text, and the website saves it to its own location. That&#8217;s it. You, or anyone else who has that URL, can view the text. It&#8217;s meant to be used by programmers and such to share things like code snippets and log messages. Fortunately, it lets you choose how long your text will remain on the server. If we save our .bashrc here, we can always return to it later to get what we need. You can choose, when saving your file, how long to keep the files stored on Pastebin.com.</p>
<p><img class="aligncenter size-full wp-image-10526" src="http://imagecdn.maketecheasier.com/2010/01/pastebin-standard.jpg" alt="pastebin-standard" width="577" height="379" /></p>
<p>If you stop here and just go the normal route, your file will be given an URL like <em>http://pastebin.com/d535effd9</em>. That&#8217;s not so easy to remember, so we go one step further and use&#8230;</p>
<h3>&#8220;Private&#8221; Pastebin</h3>
<p>A clever feature to Pastebin.com is that it allows you to create your own personal subdomain on the fly. For example, instead of going to just <em>http://pastebin.com</em>, you use your name as a subdomain (ie <em>http://joshprice.pastebin.com</em>) you&#8217;ll get your own little section to leave your text. Now, the word &#8220;private&#8221; is quotes here because there&#8217;s nothing keeping anyone else from accessing that same &#8220;private&#8221; area. In fact, if you have a common name and you try the method I suggested, you may find that someone else is already placing files there. Keep toying around until you can find something unique.</p>
<p><img class="aligncenter size-full wp-image-10529" src="http://imagecdn.maketecheasier.com/2010/01/pastebin-private.jpg" alt="pastebin-private" width="458" height="172" /></p>
<p>As you can see, the title now shows that we&#8217;re in my own private pastebin. Once again, there is nothing stopping anyone else from accessing that location and adding/changing files, it&#8217;s just a name space you can use to access things you&#8217;ve saved.</p>
<p>You may notice that the &#8220;Recent Posts&#8221; section in the top-left now shows only the posts in this private space. I can go back here in a year and see all the notes I&#8217;ve saved so far (presuming I told them to live that long, and no one else has changed them).</p>
<h3>Saving Your .bashrc</h3>
<p>Fill up your .bashrc (or whatever else you&#8217;d like to save on pastebin) with the settings you want. If you haven&#8217;t already, create a unique private space as described in the previous section. Paste in the contents of your file, choose how long you&#8217;d like to to stay on the server, and hit <em>Send</em>. You&#8217;ll be taken to the URL of your text file, which you can save or send to others.</p>
<h3>Retrieving Your .bashrc</h3>
<p>There are a few ways you could go about putting your file back on your system once the install is complete.</p>
<p><strong>Simplest -</strong> Open your private pastebin address and the post you&#8217;re looking for. Highlight all the text, open your exising .bashrc file and add the pastebin info to the end.</p>
<p><strong>Command Line -</strong> From your browser, open your private pastebin address and the post you&#8217;re looking for. You&#8217;ll see a <em>Download</em> button in the header bar above your post. Right-click the link and choose &#8220;Copy Link Location&#8221; (or your browser&#8217;s equivalent). From the command line, enter</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-O</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bashrc <span style="color: #7a0874; font-weight: bold;">&#40;</span>pastebin <span style="color: #c20cb9; font-weight: bold;">link</span> location<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>to save the file from pastebin directly into the local .bashrc file, overwriting the existing contents. If you&#8217;re able to remember the URL of your file so you don&#8217;t have to open the website, this may be the fastest method, and it wouldn&#8217;t require a browser at all.</p>
<p><strong>Recommended -</strong> Open your private pastebin address and the post you&#8217;re looking for.  You&#8217;ll see a <em>Download</em> button in the header bar above your post. Instead of <em>826492.txt</em> or whatever filename it gives you, save it in your home as something like <em>bashrc-custom</em>. You can add the line</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">source</span> bashrc-custom</pre></div></div>

<p>to the existing .bashrc file, so that you get all the shell options the distro included as well as your customizations.</p>
<p><!--adsense#468x60--><br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27' title='How to Supercharge Your Shell with Bashish [Linux]'>How to Supercharge Your Shell with Bashish [Linux]</a></li>
<li><a href='http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09' title='10 Useful Tools, Websites And Tricks to Help You Master Linux Command'>10 Useful Tools, Websites And Tricks to Help You Master Linux Command</a></li>
<li><a href='http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04' title='How to Get a Quake-style Drop-down Terminal in Linux'>How to Get a Quake-style Drop-down Terminal in Linux</a></li>
<li><a href='http://maketecheasier.com/sudo-vs-su-linux-mte-explains/2012/04/24' title='Sudo vs Su [Linux] (MTE Explains)'>Sudo vs Su [Linux] (MTE Explains)</a></li>
</ul>
<p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/save-share-bash-settings-using-pastebin/2010/01/05&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/save-share-bash-settings-using-pastebin/2010/01/05" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/save-share-bash-settings-using-pastebin/2010/01/05" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/save-share-bash-settings-using-pastebin/2010/01/05" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/save-share-bash-settings-using-pastebin/2010/01/05&amp;title=How+to+Save+and+Share+Bash+Settings+Using+Pastebin&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/save-share-bash-settings-using-pastebin/2010/01/05" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/save-share-bash-settings-using-pastebin/2010/01/05">How to Save and Share Bash Settings Using Pastebin</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://maketecheasier.com/save-share-bash-settings-using-pastebin/2010/01/05/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>8 Useful and Interesting Bash Prompts</title>
		<link>http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04</link>
		<comments>http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04#comments</comments>
		<pubDate>Fri, 04 Sep 2009 12:00:27 +0000</pubDate>
		<dc:creator>Joshua Price</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://maketecheasier.com/?p=6712</guid>
		<description><![CDATA[Many people don&#8217;t think of their command prompt as a particularly useful thing, or even pay it much attention. To me, this is a bit of a shame, as a useful prompt can change the way you use the command line. Well I&#8217;ve scoured the Interwebs looking for the best,... <p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04&amp;title=8+Useful+and+Interesting+Bash+Prompts&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04">8 Useful and Interesting Bash Prompts</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></description>
			<content:encoded><![CDATA[<p><img src="http://imagecdn.maketecheasier.com/2009/08/bachprompts-main.jpg" alt="bachprompts-main" width="170" height="127" class="alignleft size-full wp-image-6939" />Many people don&#8217;t think of their command prompt as a particularly useful thing, or even pay it much attention.  To me, this is a bit of a shame, as a useful prompt can change the way you use the command line.  Well I&#8217;ve scoured the Interwebs looking for the best, most useful, or sometimes most amusing bash prompts.  Here, in no particular order, are the ones I&#8217;d be most likely to use on my computers.</p>
<p><em>Note &#8211; to use any of these prompts, you can copy &amp; paste the &#8220;PS1=&#8221; line directly into your terminal.  To make the change permanent, paste the line to the end of your </em>~/.bashrc<em> file. </em><br />
<span id="more-6712"></span></p>
<h3>1. Show Happy face upon successful execution</h3>
<p>This prompt is probably the most amusing one on the list, but remains useful.  The idea is that as long as your commands execute successfully, your prompt shows a happy face.  Any time a command fails, it shows a sad face instead.</p>
<p>Example:<br />
<img class="aligncenter size-full wp-image-6786" src="http://imagecdn.maketecheasier.com/2009/08/bashprompts-happyface.jpg" alt="bashprompts-happyface" width="298" height="111" /><br />
Code:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;\<span style="color: #780078;">`if [ \$? = 0 ]; then echo \[\e[33m\]^_^\[\e[0m\]; else echo \[\e[31m\]O_O\[\e[0m\]; fi\`</span>[\u@\h:\w]\<span style="color: #000099; font-weight: bold;">\$</span> &quot;</span></pre></div></div>

<h3>2.Change color on bad command</h3>
<p>Here&#8217;s one of my favorites.  This prompt has it all.  Like above, the prompt changes color if your last command failed to run successfully, but it also shortens long paths and contains the <a href="http://maketecheasier.com/mastering-the-bash-history/2009/05/20" target="_blank">bash history</a> number of each command for easy retrieval.</p>
<p>Example:<br />
<img class="aligncenter size-full wp-image-6791" src="http://imagecdn.maketecheasier.com/2009/08/bashprompts-hurring.jpg" alt="bashprompts-hurring" width="378" height="154" /><br />
Code:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PROMPT_COMMAND</span>=<span style="color: #ff0000;">'PS1=&quot;\[\033[0;33m\][\!]\`if [[ \$? = &quot;0&quot; ]]; then echo &quot;\\[\\033[32m\\]&quot;; else echo &quot;\\[\\033[31m\\]&quot;; fi\`[\u.\h: \`if [[ `pwd|wc -c|tr -d &quot; &quot;` &gt; 18 ]]; then echo &quot;\\W&quot;; else echo &quot;\\w&quot;; fi\`]\$\[\033[0m\] &quot;; echo -ne &quot;\033]0;`hostname -s`:`pwd`\007&quot;'</span></pre></div></div>

<h3>3. Multi lines prompt</h3>
<p>If you&#8217;re the type who wants to pack your prompt full of information, then here&#8217;s the one for you.  This one is a multi-line prompt containing date/time, full path, user and host, active terminal, even file count and space usage.<br />
Example:<br />
<img class="aligncenter size-full wp-image-6794" src="http://imagecdn.maketecheasier.com/2009/08/bashprompts-informant.jpg" alt="bashprompts-informant" width="392" height="162" /><br />
Code:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>\[\033[35m\]<span style="color: #000099; font-weight: bold;">\$</span>(/bin/date)<span style="color: #000099; font-weight: bold;">\n</span>\[\033[32m\]\w<span style="color: #000099; font-weight: bold;">\n</span>\[\033[1;31m\]\u@\h: \[\033[1;34m\]<span style="color: #000099; font-weight: bold;">\$</span>(/usr/bin/tty | /bin/sed -e 's:/dev/::'): \[\033[1;36m\]<span style="color: #000099; font-weight: bold;">\$</span>(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files \[\033[1;33m\]<span style="color: #000099; font-weight: bold;">\$</span>(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\033[0m\] -&gt; \[\033[0m\]&quot;</span></pre></div></div>

<h3>4. Color manage your prompt</h3>
<p>There&#8217;s nothing particularly fancy about this prompt, other than the good use of color to separate the different pieces of information.  As you can see, it provides time, username, hostname, and current directory.  Fairly minimal but useful.</p>
<p>Example:<br />
<img class="aligncenter size-full wp-image-6808" src="http://imagecdn.maketecheasier.com/2009/08/bashprompts-4.jpg" alt="bashprompts-4" width="333" height="69" /><br />
Code:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;\[\033[35m\]<span style="color: #000099; font-weight: bold;">\t</span>\[\033[m\]-\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]<span style="color: #000099; font-weight: bold;">\$</span> &quot;</span></pre></div></div>

<h3>5. Show full path</h3>
<p>This one&#8217;s a nice, clean, minimal 2-line prompt (plus a blank line at the top).  You&#8217;ve got your full path at the first line and pretty much just the username at the bottom.  If you want to remove the blank line at the start of every prompt, just take out the first &#8220;\n&#8221;.</p>
<p>Example:<br />
<img class="aligncenter size-full wp-image-6818" src="http://imagecdn.maketecheasier.com/2009/08/bashprompts-5.jpg" alt="bashprompts-5" width="231" height="126" /></p>
<p>Code:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;[\[\033[32m\]\w]\[\033[0m\]<span style="color: #000099; font-weight: bold;">\n</span>\[\033[1;36m\]\u\[\033[1;33m\]-&gt; \[\033[0m\]&quot;</span></pre></div></div>

<h3>6. Show background job count</h3>
<p>Another nifty 2-liner, but this one&#8217;s got some info we haven&#8217;t used before.  The first line is the normal user@host, with full path.  On the second line we&#8217;ve got history number and a count of the jobs running in the background.</p>
<p>Example:<br />
<img class="aligncenter size-full wp-image-6835" src="http://imagecdn.maketecheasier.com/2009/08/bashprompts-61.jpg" alt="bashprompts-6" width="310" height="114" /></p>
<p>Code:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">'\[\e[1;32m\]\u@\H:\[\e[m\] \[\e[1;37m\]\w\[\e[m\]\n\[\e[1;33m\]hist:\! \[\e[0;33m\] \[\e[1;31m\]jobs:\j \$\[\e[m\] '</span></pre></div></div>

<h3>7. Display directory information</h3>
<p>A very elegant and nice looking prompt design.  With this one we&#8217;ve got user/host, number of jobs, and date/time on the top line.  Below that is current directory along with number of files in that directory and their disk usage.</p>
<p>Example:<br />
<img class="aligncenter size-full wp-image-6838" src="http://imagecdn.maketecheasier.com/2009/08/bashprompts-7.jpg" alt="bashprompts-7" width="399" height="134" /></p>
<p>Code:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>\[\e[30;1m\]\[\016\]l\[\017\](\[\e[34;1m\]\u@\h\[\e[30;1m\])-(\[\e[34;1m\]\j\[\e[30;1m\])-(\[\e[34;1m\]\@ \d\[\e[30;1m\])-&gt;\[\e[30;1m\]<span style="color: #000099; font-weight: bold;">\n</span>\[\016\]m\[\017\]-(\[\[\e[32;1m\]\w\[\e[30;1m\])-(\[\e[32;1m\]<span style="color: #000099; font-weight: bold;">\$</span>(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files, <span style="color: #000099; font-weight: bold;">\$</span>(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\e[30;1m\])--&gt; \[\e[0m\]&quot;</span></pre></div></div>

<h3>8. My Prompt</h3>
<p>And finally, the prompt I personally like to use.  It&#8217;s a modification of #7, changed to take up less space and include only the information I most want in my prompt.  I like the two-line style as it lets me see the full path without reducing the space for my actual commands.</p>
<p>Example:<br />
<img class="aligncenter size-full wp-image-6845" src="http://imagecdn.maketecheasier.com/2009/08/bashprompts-8.jpg" alt="bashprompts-8" width="268" height="136" /><br />
Code:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>\[\e[32;1m\](\[\e[37;1m\]\u\[\e[32;1m\])-(\[\e[37;1m\]jobs:\j\[\e[32;1m\])-(\[\e[37;1m\]\w\[\e[32;1m\])<span style="color: #000099; font-weight: bold;">\n</span>(\[\[\e[37;1m\]! \!\[\e[32;1m\])-&gt; \[\e[0m\]&quot;</span></pre></div></div>

<p>If you&#8217;d like to share your prompt, please do so in the comments below.  </p>
<p><!--adsense#468x60--><br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19' title='Making The Linux Command Line A Little Friendlier'>Making The Linux Command Line A Little Friendlier</a></li>
<li><a href='http://maketecheasier.com/write-linux-shell-scripts/2011/06/30' title='The Beginner Guide to Writing Linux Shell Scripts'>The Beginner Guide to Writing Linux Shell Scripts</a></li>
<li><a href='http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27' title='How to Supercharge Your Shell with Bashish [Linux]'>How to Supercharge Your Shell with Bashish [Linux]</a></li>
<li><a href='http://maketecheasier.com/mastering-the-bash-history/2009/05/20' title='Mastering the Bash History'>Mastering the Bash History</a></li>
</ul>
<p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04&amp;title=8+Useful+and+Interesting+Bash+Prompts&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04">8 Useful and Interesting Bash Prompts</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04/feed</wfw:commentRss>
		<slash:comments>141</slash:comments>
		</item>
		<item>
		<title>How to Get a Quake-style Drop-down Terminal in Linux</title>
		<link>http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04</link>
		<comments>http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04#comments</comments>
		<pubDate>Thu, 04 Jun 2009 12:05:11 +0000</pubDate>
		<dc:creator>Joshua Price</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[quake]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[yakuake]]></category>

		<guid isPermaLink="false">http://maketecheasier.com/?p=5097</guid>
		<description><![CDATA[A lot of games out there have some form of command prompt, often just for entering cheat codes. You know the type &#8211; you hit some function key and a bar drops down from the top of the screen letting you enter commands or codes or whatever else. Well some... <p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04&amp;title=How+to+Get+a+Quake-style+Drop-down+Terminal+in+Linux&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04">How to Get a Quake-style Drop-down Terminal in Linux</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-medium wp-image-5126" src="http://imagecdn.maketecheasier.com/2009/06/yakuake-mainimage.jpg" alt="Main Image" width="300" height="188" />A lot of games out there have some form of command prompt, often just for entering cheat codes.  You know the type &#8211; you hit some function key and a bar drops down from the top of the screen letting you enter commands or codes or whatever else.  Well some clever folks have taken that design and applied it to the command prompt in your Linux desktop.  You can get a fully featured, skinnable terminal with split-screen views and all at the touch of a button.  <a href="http://www.kde-apps.org/content/show.php?content=29153" target="_blank">Yakuake</a> is just such a program.  It&#8217;s been around for a few years but has remained below the radar for most Linux users.</p>
<p><span id="more-5097"></span>I had always set a special desktop just for my terminals.  Readers of some of my <a href="http://maketecheasier.com/create-a-great-window-maker-desktop/2009/02/14">other articles</a> may have noticed that when setting up virtual desktops, I always set Desktop #2 for my terminals.  I typically have more than one open, so they have their own desktop workspace.  I put it in between my Browser and Text workspaces because I&#8217;m frequently copy/pasting to and from those other workspaces so it makes sense to be next to each other.   When a friend suggested I try Yakuake (thanks AWOL!) I was a bit reluctant, as my current setup had always worked so well.  I installed it anyway, and within a week I was converted.</p>
<p>To see why, let&#8217;s get Yakuake installed.  On Ubuntu or any other Debian-style distribution, open a regular terminal and type in:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> yakuake</pre></div></div>

<p>You could of course use whatever package installation method you prefer.</p>
<p>Once installed, run</p>
<p class="codeblock">yakuake &amp;</p>
<p>from the command line.  The &#8220;&amp;&#8221; at the end is just a bash code to run this program in the background so you can still use your current terminal screen even while Yakuake is running.</p>
<p>Once it loads up you&#8217;ll be shown a notice that the program is started.  You&#8217;ll also be given an option to change which key is used to make the menu appear.  By default, it&#8217;s set to F12 but you can set it to whatever you&#8217;d like.  Of course, it&#8217;s a good idea to pick a key you don&#8217;t normally use in other programs.</p>
<p>Once that&#8217;s done, hit F12 or whatever other key you specified to make the terminal appear.  It should look something like this:</p>
<p><img class="aligncenter size-full wp-image-5099" src="http://imagecdn.maketecheasier.com/2009/06/yakuake-default.jpg" alt="Basic default Yakuake config" width="560" height="448" /></p>
<p>Pretty good, but it could be better.  To improve Yakuake&#8217;s functionality, there are a few preferences we can set.  To open the configuration screen, look in the bottom right corner for the button shown here:</p>
<p><img class="aligncenter size-full wp-image-5113" src="http://imagecdn.maketecheasier.com/2009/06/yakuake-settings-button.png" alt="yakuake-settings-button" width="154" height="101" /></p>
<p>This will open the menu where you can choose &#8220;Configure Yakuake&#8221;.  There are a decent number of config options to choose from.</p>
<p>On the first page, the one titled Window, you can set things like the size of the Yakuake window.  If you don&#8217;t use the terminal much, then it might be wise to set the width to something smaller than the default 90%.  Something like 50% might be more appropriate.  If, like me, you tend to use the terminal often, I&#8217;d suggest leaving the window nice and wide because (as we&#8217;ll cover in a moment) the Yakuake window can be split into panes, so you can fit 2, 4, however many terminals you like into the single Yakuake window.</p>
<p><img class="aligncenter size-full wp-image-5116" src="http://imagecdn.maketecheasier.com/2009/06/yakuake-config-window.jpg" alt="Default first config page" width="560" height="453" /></p>
<p>The next configuration page is the Behavior config.  On here, I&#8217;d suggest unchecking &#8220;Keep window open when it loses focus&#8221;.  Having this unchecked will make Yakuake disappear as soon as you click away onto another program.  I also tend to remove the option for &#8220;Show startup notification popup&#8221;.  Otherwise you&#8217;ll get a little notice in the corner every time the program loads.  Personally, I don&#8217;t see a point in that.</p>
<p><img class="aligncenter size-full wp-image-5119" src="http://imagecdn.maketecheasier.com/2009/06/yakuake-config-behavior.jpg" alt="Yakuake's Behavior config section" width="560" height="453" /></p>
<p>The final config page is the Appearance section.  Everything on there is pretty self-explanatory so I won&#8217;t go into much detail on that, except to say that you can enable translucency to get a nice semi-transparent look to your Yakuake window. It requires you to be running  X with compositing enabled (which should be the default on most modern setups).</p>
<p>The last feature I&#8217;d like to cover is one I mentioned earlier in this article, the ability to split the Yakuake window into multiple terminal sessions.  That&#8217;s easily done by right-clicking the &#8220;+&#8221; icon in the bottom-left corner of the Yakuake window.  You can choose how to arrange those terminals inside the window if you have a preference between, say, a horizontal split or a vertical split.</p>
<p><img class="aligncenter size-full wp-image-5124" src="http://imagecdn.maketecheasier.com/2009/06/yakuake-split-terminal.png" alt="Example of how to split the terminal" width="366" height="176" /></p>
<p>You can also left-click the &#8220;+&#8221; button to have multiple terminals in tabs instead of split screen if you want the full window space for one terminal.</p>
<p>Have you used Yakuake or something similar in the past?  How has it worked out for you?  I&#8217;d love to hear your thoughts in the comments.</p>
<p><!--adsense#468x60--><br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://maketecheasier.com/10-useful-tools-websites-tricks-to-master-linux-command/2010/11/09' title='10 Useful Tools, Websites And Tricks to Help You Master Linux Command'>10 Useful Tools, Websites And Tricks to Help You Master Linux Command</a></li>
<li><a href='http://maketecheasier.com/sudo-vs-su-linux-mte-explains/2012/04/24' title='Sudo vs Su [Linux] (MTE Explains)'>Sudo vs Su [Linux] (MTE Explains)</a></li>
<li><a href='http://maketecheasier.com/start-with-vim-linux/2012/03/01' title='How to Start With Vim [Linux]'>How to Start With Vim [Linux]</a></li>
<li><a href='http://maketecheasier.com/knowing-linux-system-via-the-command-line/2012/02/23' title='Knowing Your Linux System Via the Command Line'>Knowing Your Linux System Via the Command Line</a></li>
</ul>
<p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04&amp;title=How+to+Get+a+Quake-style+Drop-down+Terminal+in+Linux&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04">How to Get a Quake-style Drop-down Terminal in Linux</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://maketecheasier.com/how-to-get-a-quake-style-drop-down-terminal-in-linux/2009/06/04/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Mastering the Bash History</title>
		<link>http://maketecheasier.com/mastering-the-bash-history/2009/05/20</link>
		<comments>http://maketecheasier.com/mastering-the-bash-history/2009/05/20#comments</comments>
		<pubDate>Wed, 20 May 2009 12:32:08 +0000</pubDate>
		<dc:creator>Joshua Price</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://maketecheasier.com/?p=4706</guid>
		<description><![CDATA[The Bourne Again Shell, better known as bash, is the default for most Linux distributions. It&#8217;s extremely powerful as far as command shells go, and holds all kinds of nifty tricks for those willing to learn. One of the best features is, in my opinion, the command history system. There... <p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/mastering-the-bash-history/2009/05/20&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/mastering-the-bash-history/2009/05/20" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/mastering-the-bash-history/2009/05/20" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/mastering-the-bash-history/2009/05/20" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/mastering-the-bash-history/2009/05/20&amp;title=Mastering+the+Bash+History&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/mastering-the-bash-history/2009/05/20" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/mastering-the-bash-history/2009/05/20">Mastering the Bash History</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-4801" src="http://imagecdn.maketecheasier.com/2009/05/bash-history-terminal.png" alt="bash-history-terminal" width="200" height="178" />The <em>Bourne Again Shell</em>, better known as <em>bash</em>, is the default for most Linux distributions.  It&#8217;s extremely powerful as far as command shells go, and holds all kinds of nifty tricks for those willing to learn.  One of the best features is, in my opinion, the command history system.</p>
<p>There are many options to use with the bash history, some of them I use nearly every time I open a command shell.  Today I&#8217;ll be covering some of the most useful aspects of the history, but I certainly won&#8217;t be able to cover them all.<br />
<span id="more-4706"></span></p>
<h3>Up/Down Arrows</h3>
<p>Many of you probably know this one, but for anyone who doesn&#8217;t, it&#8217;ll make your life a lot easier.  Any time you&#8217;re in the command shell, simply use the up and down arrows on your keyboard to move through the list of previously entered commands.  Next time you enter a long command that turns out to have a typo, you don&#8217;t have to retype the whole thing just hit the up arrow and make whatever edits are needed.</p>
<h3>!!</h3>
<p>A similar feature to the one listed above is the double bang (!!).  Those characters entered in the shell represent the last typed command.  Let&#8217;s say you&#8217;re trying to run a command only to find out that you need root privileges to do it.  Instead of retyping the whole command, you can simply enter</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">!!</span></pre></div></div>

<p>Bash will substitute the !! for the previous command, as in the example below.</p>
<p><img class="aligncenter size-full wp-image-4772" src="http://imagecdn.maketecheasier.com/2009/05/bash-history-bangbang.png" alt="bash-history-bangbang" width="367" height="103" /></p>
<p>This also works further backward, you can do something like</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">!</span>-<span style="color: #000000;">5</span></pre></div></div>

<p>to recall the command 5 entries back in the history.</p>
<h3>!(word)</h3>
<p>Perhaps a few days ago you typed a long, complex command into your shell, for example a series of options for &#8220;wterm&#8221;.  You can find and re-enter than command by using the history&#8217;s built in search.  You simply add the first few letters of the command after the ! and bash will find it.</p>
<p><img class="aligncenter size-full wp-image-4778" src="http://imagecdn.maketecheasier.com/2009/05/bash-history-bangword.png" alt="Example of !(word)" width="464" height="95" /></p>
<p><em>Be careful with this one.  You may end up running something other than what you expected.  Don&#8217;t use this for potentially dangerous commands like &#8220;rm&#8221; or &#8220;fdisk&#8221;. </em></p>
<h3>!?(word)</h3>
<p>This is similar to the last feature in that it searches the history for the word entered, but unlike !(word) this will find the word anywhere in the command, not just the beginning.</p>
<p><img class="aligncenter size-full wp-image-4781" src="http://imagecdn.maketecheasier.com/2009/05/bash-history-bangquestion.png" alt="bash-history-bangquestion" width="454" height="70" /></p>
<p><em>Be careful with this one.  You may end up running something other than what you expected.  Don&#8217;t use this for potentially dangerous commands like &#8220;rm&#8221; or &#8220;fdisk&#8221;. </em></p>
<h3>Ctrl-R</h3>
<p>This one may be my personal favorite history tool.  It&#8217;s a bit like the <em>!?</em> item above, but interactive.  In your command shell, hit <em>Ctrl-R</em>, and it will begin a search.  As you type, bash will search the history and show you the results as you type.  When it shows the command you want, simply hit enter and it will run that command.  This can be safer than things like <em>!?</em> because you can see what the command will be before you run it, so you don&#8217;t have to guess or rely on memory.</p>
<p><img class="aligncenter size-full wp-image-4789" src="http://imagecdn.maketecheasier.com/2009/05/bash-history-ctrl-r.png" alt="Example of Ctrl-R in the shell" width="515" height="37" /></p>
<h3>Manual Search</h3>
<p>Perhaps you don&#8217;t like the way Ctrl-R works, or you want to see ALL the commands you typed, or just the ones that contain a particular word.  The <em>history</em> command will show you your full command history, along with the history number of each command (hold that thought, we&#8217;ll cover those numbers in a moment).</p>
<p>You can also specify the number of items the <em>history</em> command will show.  To see the last 10 entries in the history, you could type</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">history</span> <span style="color: #000000;">10</span></pre></div></div>

<p>To see all history entries that contain a particular word, you can use <em>grep </em>to filter the results, like below.</p>
<p><img class="aligncenter size-full wp-image-4794" src="http://imagecdn.maketecheasier.com/2009/05/bash-history-grep.png" alt="Example of using grep to filter history list" width="351" height="122" /></p>
<h3>!(number)</h3>
<p>When you use the <em>history</em> command to view your command history list, you&#8217;ll notice each item in the list has a number associated with it.  You can use that to recall that particular command.  For example, item 87 could be run again by entering</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">!</span><span style="color: #000000;">87</span></pre></div></div>

<p>into your shell.</p>
<h3>Word replacement</h3>
<p>This one&#8217;s pretty great.  How many times have you written out some big long command only to realize you put, say, <em>hdd</em> when you wanted <em>hdc</em>?  Well bash has you covered.  You can replace a word in the previous command with another using &#8220;^&#8221;, as in the example below</p>
<p><img class="aligncenter size-full wp-image-4798" src="http://imagecdn.maketecheasier.com/2009/05/bash-history-wordreplacement1.png" alt="Example of word replacement with &quot;^&quot;" width="540" height="104" /></p>
<h3>Managing Your History</h3>
<p>By default, the history is saved in ~/.bash_history.  You can deal with this file however you see fit, but there are some useful things you could try to manage it automatically.  Namely, setting the environment variables <strong>HISTSIZE</strong> and <strong>HISTFILESIZE</strong>.  To set the number of entries that can be saved in the history file to 1000, enter</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTFILESIZE</span>=<span style="color: #000000;">1000</span></pre></div></div>

<p>into your shell.  This will limit the file to 1000 entries.  If you want to make this change permanent, put that export command into your .bashrc or .bash_profile file.</p>
<p><!--adsense#468x60--><br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://maketecheasier.com/write-linux-shell-scripts/2011/06/30' title='The Beginner Guide to Writing Linux Shell Scripts'>The Beginner Guide to Writing Linux Shell Scripts</a></li>
<li><a href='http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04' title='8 Useful and Interesting Bash Prompts'>8 Useful and Interesting Bash Prompts</a></li>
<li><a href='http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19' title='Making The Linux Command Line A Little Friendlier'>Making The Linux Command Line A Little Friendlier</a></li>
<li><a href='http://maketecheasier.com/remove-recent-history-lists-in-ubuntu/2012/02/20' title='How to Remove Recent History Lists In Ubuntu 11.10'>How to Remove Recent History Lists In Ubuntu 11.10</a></li>
</ul>
<p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/mastering-the-bash-history/2009/05/20&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/mastering-the-bash-history/2009/05/20" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/mastering-the-bash-history/2009/05/20" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/mastering-the-bash-history/2009/05/20" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/mastering-the-bash-history/2009/05/20&amp;title=Mastering+the+Bash+History&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/mastering-the-bash-history/2009/05/20" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/mastering-the-bash-history/2009/05/20">Mastering the Bash History</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://maketecheasier.com/mastering-the-bash-history/2009/05/20/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Making The Linux Command Line A Little Friendlier</title>
		<link>http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19</link>
		<comments>http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19#comments</comments>
		<pubDate>Thu, 19 Mar 2009 13:03:50 +0000</pubDate>
		<dc:creator>Joshua Price</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[alias]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://maketecheasier.com/?p=3366</guid>
		<description><![CDATA[One thing that gets debated over and over in Linux is the need for the command line. Many say that you should never need to access a command prompt to get things done, others are of the opinion that the power of the Linux shell is one of the things... <p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19&amp;title=Making+The+Linux+Command+Line+A+Little+Friendlier&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19">Making The Linux Command Line A Little Friendlier</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-3367 alignleft" src="http://imagecdn.maketecheasier.com/2009/03/konsole.png" alt="Console icon" width="128" height="128" />One thing that gets debated over and over in Linux is the need for the command line. Many say that you should never need to access a command prompt to get things done, others are of the opinion that the power of the Linux shell is one of the things that makes Linux so great. While I would fall into the latter category, I can certainly understand why people can get frustrated with having to learn complex and seemingly obscure commands to get their computer to work right. Even if you hate the command line, you often have no choice but to open it once in a while to get the job done. Today, we&#8217;ll be covering various ways to make it a little easier to navigate.</p>
<p><span id="more-3366"></span>For those just starting out with Linux, or the command line specifically, the program that displays the command prompt and handles your commands is called <em>bash</em>, or the Bourne Again Shell. In this article we&#8217;ll be using the words <em>command line</em> and <em>shell</em> interchangeably to refer to interacting with Linux through bash.</p>
<p>Today we&#8217;ll be covering:</p>
<ul>
<li>Changing the shell startup routine</li>
<li>Making a more useful command prompt</li>
<li>Creating aliases for long or complex commands</li>
</ul>
<h3>.bashrc and .bash_profile</h3>
<p>These two files are often the source of some confusion. At first appearance, they seem to do the exact same thing &#8211; running startup instructions every time you open a command prompt. In short, <em>.bash_profile</em> runs when you start a shell from a login screen (such as a console system login) and <em>.bashrc</em> runs for non-login shells (such as running Terminal from your system menu).  The <em>.bashrc</em> file is the one you&#8217;ll be using the majority of the time so that&#8217;s the one we&#8217;ll use in our examples today.</p>
<p>As I said, .bashrc is loaded by bash whenever you open a new shell. Chances are you already have a .bashrc file that was created for you when you first installed your Linux system. To see what&#8217;s already in there, load up your preferred text editor and open</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>YourUserName<span style="color: #000000; font-weight: bold;">/</span>.bashrc</pre></div></div>

<p>(By default, the file is hidden from public view. You&#8217;ll have to right-click and select Show Hidden Files before it can show itself.)</p>
<p>You&#8217;ll probably see several lines of code, bash shell scripting to be precise, already in there. The default .bashrc in most distros has some code to do things like color prompts (which we&#8217;ll get into a little bit) and some handy aliases (which we&#8217;ll get into a lot).</p>
<p><img class="aligncenter size-full wp-image-3381" src="http://imagecdn.maketecheasier.com/2009/03/default-bashrc.png" alt="The default .bashrc file for Ubuntu 8.10" width="560" height="508" /></p>
<p>Feel free to glance through the current contents of the file so you have an idea what&#8217;s already happening on each new shell session, but for the sake of this article we can safely ignore the current settings and just add what we want to the end.</p>
<p>Instead of putting our new items directly into the .bashrc file, we&#8217;re going to take a slightly different approach.  Each user on the system has their own .bashrc file in their home directory. If we wanted to make changes to the way bash runs, we&#8217;d have to place our changes in each of those files. If you later decide that what you did wasn&#8217;t quite what you wanted, you&#8217;d have to go through all of those files again and make your updates. Instead of all that hassle, we&#8217;re going to make a single file with all our custom settings, and just tell .bashrc to load from that file.  The diagram below demonstrates:</p>
<p><img class="aligncenter size-full wp-image-3510" src="http://imagecdn.maketecheasier.com/2009/03/source-diagram1.jpg" alt="Diagram representing file sourcing" width="550" height="395" /></p>
<p>By placing the <em>source</em> command at the end of the .bashrc file, it will pull our commands in from the custom-shell.sh file and overwrite the default prompt and default aliases with the ones we&#8217;ve specified. This way, we can make a single file (/etc/custom-shell.sh or whatever else you&#8217;d like to name it) and just tell each user&#8217;s .bashrc file to load it. So if you&#8217;ve still got your .bashrc file loaded in your text editor, move all the way down to the bottom and add</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">source</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>custom-shell.sh</pre></div></div>

<p>Note &#8211; you can take this a step further and add the <em>source</em> line to the .bashrc file in <em>/etc/skel</em>. That way, all new users created on the system will already have our <em>source</em> line included!</p>
<p>Save the .bashrc file and then create a new, blank text file named custom-shell.sh.  This is where we&#8217;ll be putting all of the new settings in the following sections.</p>
<h3>The Prompt</h3>
<p>Every system has a default prompt. Usually, it&#8217;s a bland, default prompt with only a little bit of useful information.  It probably looks something like:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">josh<span style="color: #000000; font-weight: bold;">@</span>roberts:~$</pre></div></div>

<p>To test out exactly how prompt customisation is done, enter the following into the shell:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;Custom &gt; &quot;</span></pre></div></div>

<p>This will turn your prompt into a simple arrow.  No useful info of any kind, but it shows the basic idea of how you change the contents of your prompt.</p>
<p>Over the years, people have taken prompt customisation to the extreme, putting all kinds of info into it. I won&#8217;t go into a huge amount of detail on how to handle colors and multi-line prompts and adding live info, but I will give a nice looking, useful prompt that you could use as a base for your own. In the custom-shell.sh file we created earlier, paste in:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>\[\033[1;36m\]\u\[\033[1;37m\] \[\033[0;36m\]<span style="color: #780078;">`date`</span><span style="color: #000099; font-weight: bold;">\n</span>\[\033[0m\][\[\033[1;33m\]\w\[\033[0m\]] &quot;</span></pre></div></div>

<p>Most of what you see there are color codes telling bash to switch back and forth between various colors for the text in the prompt. The end result of all this gibberish is a rather nice looking and easy to understand prompt.</p>
<p><img class="aligncenter size-full wp-image-3467" src="http://imagecdn.maketecheasier.com/2009/03/newprompt.png" alt="New prompt after changes" width="484" height="316" /></p>
<p>Save the custom-shell.sh file after pasting in the code above. If you save it in /etc, you&#8217;ll probably need root privileges. You can save it anywhere you want, but make sure you point your .bashrc to the right place. To test out your new prompt, you can either close and re-open your shell, or just type</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">source</span> .bashrc</pre></div></div>

<p>into your current shell.</p>
<p>Your .bashrc file should read our new prompt info from the custom-shell.sh file and make your prompt nice and fancy with colors and all.</p>
<p>For an EXTREMELY detailed guide on prompt magic, see the <a title="Linux Prompt HOWTO" href="http://www.linux.org/docs/ldp/howto/Bash-Prompt-HOWTO/index.html" target="_blank">Official Linux Prompt HOWTO</a>.<br />
<a name="alias"></a><br />
<h3>Aliases</h3>
<p>I might as well tell you up front &#8211; I love aliases. The first thing I do when I install a new system is set up my preferred aliases. As the name implies, an alias is just another name for a command. For example, my most used alias is one I call &#8220;gimme&#8221; which bash translates to &#8220;sudo apt-get install&#8221;. You can use aliases for a variety of reasons, such as shortening a long command or making the Linux shell act more like a Windows/Mac/Solaris/BSD/Whatever shell. I suggest pasting the following aliases into your custom-shell.sh file. Those who use distros other than Debian/Ubuntu style can translate the apt-get aliases into the appropriate <em>yum</em> command, or whatever package utility you prefer, and of course the same is true for aptitude and portage users.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#Apt-related aliases</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">gimme</span>=<span style="color: #ff0000;">&quot;sudo apt-get install&quot;</span>            <span style="color: #666666; font-style: italic;">#Install new software</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">acs</span>=<span style="color: #ff0000;">&quot;apt-cache search&quot;</span>                    <span style="color: #666666; font-style: italic;">#Search available packages</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">purge</span>=<span style="color: #ff0000;">&quot;apt-get --purge remove&quot;</span>        <span style="color: #666666; font-style: italic;">#Removes package and its config files</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">update</span>=<span style="color: #ff0000;">&quot;sudo apt-get update&quot;</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">debclean</span>=<span style="color: #ff0000;">&quot;sudo apt-get clean &amp;amp;&amp;amp; sudo apt-get autoremove&quot;</span>  <span style="color: #666666; font-style: italic;">#Removes some unneeded files</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#Misc useful aliases</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">ls</span>=<span style="color: #ff0000;">&quot;ls --color=auto&quot;</span>                           <span style="color: #666666; font-style: italic;">#Plain ls with color</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">ll</span>=<span style="color: #ff0000;">&quot;ls -l --color=auto&quot;</span>                         <span style="color: #666666; font-style: italic;">#Detailed list with color</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">config</span>=<span style="color: #ff0000;">&quot;dpkg-reconfigure&quot;</span>                <span style="color: #666666; font-style: italic;">#Re-run the configuration step for a package</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">cmi</span>=<span style="color: #ff0000;">&quot;./configure &amp;amp;&amp;amp; make &amp;amp;&amp;amp; sudo make install&quot;</span>    <span style="color: #666666; font-style: italic;">#Common steps to install package from source</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">numfiles</span>=<span style="color: #ff0000;">&quot;echo <span style="color: #007800;">$(ls -1 | wc -l)</span>&quot;</span>          <span style="color: #666666; font-style: italic;">#Count the number of files in current directory</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">dfree</span>=<span style="color: #ff0000;">&quot;df -h&quot;</span>                                       <span style="color: #666666; font-style: italic;">#See how much hard drive space is free in easy-to-read format</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">favdir</span>=<span style="color: #ff0000;">&quot;cd /directory/you/use/a/lot&quot;</span>   <span style="color: #666666; font-style: italic;">#Quickly switch to a directory you often need (music, documents, etc)</span></pre></td></tr></table></div>

<p>Add whatever else you think might be useful, or change the ones I&#8217;ve suggested to suit your needs. Instead of <em>gimme</em> and <em>acs</em>, you could use <em>get</em> and <em>got</em>. Some people transitioning from Windows like to make aliases to mimic Windows commands: <em>copy</em> to replace <em>cp</em>, <em>move</em> to replace <em>mv</em>, <em>ipconfig</em> to replace <em>ifconfig</em>, etc.</p>
<p>Your custom-shell.sh should now look something like this:</p>
<p><img class="aligncenter size-full wp-image-3516" src="http://imagecdn.maketecheasier.com/2009/03/custom-shell.png" alt="Example of finished file" width="448" height="528" /></p>
<p>Once the custom-shell.sh file is saved, and .bashrc is set to point to it, re-open your command prompt and you should have a nice looking, useful prompt with several handy aliases to make things a little easier.</p>
<p>I would love to hear about you favorite aliases! Leave a comment and share some useful command shortcuts you&#8217;ve found, or maybe a nice prompt.  The command line can be a very powerful tool, and I&#8217;d love to know ways you&#8217;ve found to make it even better.</p>
<p><!--adsense#468x60--><br />
<h3 class='related_post_title'>Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04' title='8 Useful and Interesting Bash Prompts'>8 Useful and Interesting Bash Prompts</a></li>
<li><a href='http://maketecheasier.com/write-linux-shell-scripts/2011/06/30' title='The Beginner Guide to Writing Linux Shell Scripts'>The Beginner Guide to Writing Linux Shell Scripts</a></li>
<li><a href='http://maketecheasier.com/7-linux-shell-tips-for-increased-productivity/2011/06/16' title='7 Linux Shell Tips For Increased Productivity'>7 Linux Shell Tips For Increased Productivity</a></li>
<li><a href='http://maketecheasier.com/supercharge-shell-with-bashish/2011/01/27' title='How to Supercharge Your Shell with Bashish [Linux]'>How to Supercharge Your Shell with Bashish [Linux]</a></li>
</ul>
<p><div style="float:left;margin-bottom:10px"><a href="http://api.tweetmeme.com/share?url=http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19&amp;service=bit.ly" target="_blank"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19" style="border:none;margin-right:5px" width="51" height="61"></a><a href="http://digg.com/tools/diggthis/login?url=http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19" target="_blank"><img src="http://images.maketecheasier.com/diggme.png" style="border:none;margin-right:5px" ></a><a href="http://www.facebook.com/sharer.php?u=http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19" target="_blank"><img src="http://images.maketecheasier.com/fb.jpg" style="border:none;margin-right:5px" ></a><a href="http://www.google.com/reader/link?url=http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19&amp;title=Making+The+Linux+Command+Line+A+Little+Friendlier&amp;srcTitle=MakeTechEasier.com" target="_blank"><img src="http://images.maketecheasier.com/gbuzz-feed.png" style="border:none;margin-right:5px" ></a><a href="http://www.stumbleupon.com/submit?url=http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19" target="_blank"><img src="http://images.maketecheasier.com/stumble.png"></a></div>
<div style="clear:both"></div>
<strong><a href="http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19">Making The Linux Command Line A Little Friendlier</a></strong> originally published on <a href="http://maketecheasier.com">Make Tech Easier</a> (<a href="http://feedproxy.google.com/MakeTechEasier">RSS</a>)
<br/>
Follow us at <a href="http://www.facebook.com/MakeTechEasier">Facebook</a> | <a href="http://twitter.com/MakeTechEasier">Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://maketecheasier.com/making-the-linux-command-line-a-little-friendlier/2009/03/19/feed</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced
Content Delivery Network via Amazon Web Services: CloudFront: cdn.maketecheasier.com

Served from: maketecheasier.com @ 2012-05-25 14:42:20 -->
