<?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>Blog.ubrious &#187; prompt</title>
	<atom:link href="http://blog.ubrio.us/tag/prompt/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ubrio.us</link>
	<description>An Ordinary Web Developer's Blog</description>
	<lastBuildDate>Thu, 19 Jan 2012 00:44:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Best Bash Prompt</title>
		<link>http://blog.ubrio.us/nix/best-bash-prompt/</link>
		<comments>http://blog.ubrio.us/nix/best-bash-prompt/#comments</comments>
		<pubDate>Thu, 15 Nov 2007 05:25:20 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Nix]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[ps1]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/osx/bash-prompt-madness/</guid>
		<description><![CDATA[Okay &#8212; so after that last post I decided it was time for a change. I&#8217;ve had the same bash prompt for years and was starting to get tired of it. Over the past 30 or so minutes I&#8217;ve been hating life learning way more than I wanted to about PS1, colors and embedded IF [...]]]></description>
			<content:encoded><![CDATA[<p>Okay &#8212; so after that last post I decided it was time for a change. I&#8217;ve had the same bash prompt for years and was starting to get tired of it. Over the past 30 or so minutes I&#8217;ve been <del>hating life</del> learning way more than I wanted to about PS1, colors and embedded IF statements.</p>
<p>And yes, this needs it own post simply for the fact that this is an insane prompt. Heres what it is/can do:</p>
<ol>
<li>Automatically shortens itself if the path is longer than 18 charachters<br/><small>This is what I&#8217;ve always wanted since I usually name my folders after the website URL &#8212; and I <em>HATE</em> 2 line prompts.</small></li>
<li>Changes to red if the last command didn&#8217;t have a return code of 0</li>
<li>Includes your bash history # for easy <a href="http://linux.deadgod.net/2007/01/01/Special_Bash_Variables_I" onclick="pageTracker._trackPageview('/outgoing/linux.deadgod.net/2007/01/01/Special_Bash_Variables_I?referer=');">history command repeating</a></li>
<li>Is pretty neat and trim</li>
</ol>
<h5>Why is this rad?</h5>
<div class='wp-caption alignleft'>
<img src="http://file.ubrio.us/misc/best_bash_prompt_ever.png" /></p>
<p class='wp-caption-text'>Prompt Madness!</p>
</div>
<p>I&#8217;ll let this image explain what it does and how it looks&#8230;</p>
<p><br clear='left' /></p>
<p>I&#8217;m tossing up a text file here -> <a href="http://file.ubrio.us/misc/best_bash_prompt_ever.txt" onclick="pageTracker._trackPageview('/outgoing/file.ubrio.us/misc/best_bash_prompt_ever.txt?referer=');">best_bash_prompt_ever.txt</a> &#8212; since the escaping will probably be messed up.</p>
<pre>
export PROMPT_COMMAND='PS1="\[\033[0;33m\][\!]\`if [[ \$? = "0" ]]; then echo "\\[\\033[32m\\]"; else echo "\\[\\033[31m\\]"; fi\`[\u.\h: \`if [[ `pwd|wc -c|tr -d " "` > 18 ]]; then echo "\\W"; else echo "\\w"; fi\`]\$\[\033[0m\] "; echo -ne "\033]0;`hostname -s`:`pwd`\007"'
</pre>
<div class='help'>The second half (from &#8220;echo -ne&#8230;&#8221; on) is for the Terminal&#8217;s title.</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/nix/best-bash-prompt/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>OSX Terminal Niceties for Remote Servers</title>
		<link>http://blog.ubrio.us/nix/osx-terminal-niceties-for-remote-servers/</link>
		<comments>http://blog.ubrio.us/nix/osx-terminal-niceties-for-remote-servers/#comments</comments>
		<pubDate>Wed, 14 Nov 2007 20:46:56 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Nix]]></category>
		<category><![CDATA[bashrc]]></category>
		<category><![CDATA[nano]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/osx/osx-terminal-niceties-for-remote-servers/</guid>
		<description><![CDATA[I have absolutely no idea what to title this as &#8212; and frankly, its more for me than anyone else. I need a place to store this before I forget and go racking my brain 2 years from now on how to do this.
If you think you&#8217;re interested &#8212; this post is about the following:

How [...]]]></description>
			<content:encoded><![CDATA[<p>I have absolutely no idea what to title this as &#8212; and frankly, its more for me than anyone else. I need a place to store this before I forget and go racking my brain 2 years from now on how to do this.</p>
<h5>If you think you&#8217;re interested &#8212; this post is about the following:</h5>
<ol>
<li>How to get your current user/directory in the title of terminal (iTerm.app for this post &#8212; same applies for Terminal.app though)</li>
<li>How to make the backspace/delete keys work properly in nano/pico on local and remote servers</li>
<li>Update your current user/path in the title when you SSH into a remote machine</li>
<li>And how to setup password-less SSH, just because its on topic</li>
</ol>
<h3>.bashrc modifications</h3>
<p>Making Terminal.app&#8217;s title update to the current user &#038; path for both local and remote servers while letting the backspace and delete key work properly &#8212; all in one solution! <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class='tip'>Get yourself a nifty shell prompt over here -><a href="http://blog.ubrio.us/osx/best-bash-prompt/">Bash Prompt Madness</a></div>
<h5>Add the following lines to both your local &#038; remote .bashrc</h5>
<pre class="brush: ruby;">
# this is what updates your Terminal's title -- you can of course modify this
# but im not explaining how -- google it
export PROMPT_COMMAND='echo -ne &quot;\\033]0;${USER}:${PWD}\\007&quot;'

# this will make OSXs backspace &amp; delete keys work properly
# in nano &amp; pico
export TERM=xterm
stty erase ^H

# fancy prompt you say?
# again -- google for more info on this
export PS1=&quot;\\[\\033[0;34m\\][\\!]\[\\033[0;32m\\][\\u.\\h: \\w]\[\\033[0;32m\\]\\$\\[\\033[0m\\] &quot;

#gives you something like:
# [0][rob.hades: ~]$ echo 'hello world!'
</pre>
<h5>Now lets bind our servers for SSH so we don&#8217;t need passwords</h5>
<p>Passwords are annoying &#8212; especially when you are using <a href="http://en.wikipedia.org/wiki/Secure_copy" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Secure_copy?referer=');">scp</a> and <a href="http://en.wikipedia.org/wiki/Rsync" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Rsync?referer=');">rsync</a> a lot.</p>
<p>Here is a very simple way to drop those passwords and have SSH do all the work.</p>
<h6>In your terminal app (Locally)</h6>
<p>Make your .ssh directory<br />
<code><span>$></span>mkdir -p ~/.ssh &#038;&#038; cd ~/.ssh</code></p>
<p>Generate yourself some keys<br />
<code><span>~/.ssh $></span>ssh-keygen -t dsa -f ~/.ssh/id_dsa</code></p>
<p>Copy your public key to your remote server (Make sure the remote server has a ~/.ssh directory as well!)<br />
<code><span>~/.ssh $></span>scp id_dsa.pub {user}@{remoteserver}:.ssh</code></p>
<h6>In the remote computer</h6>
<p>Add that public key to your authorized_keys file for SSH<br />
<code><span>$></span>cd .ssh &#038;&#038; cat id_dsa.pub >> authorized_keys2</code></p>
<p>Cleanup those files and make sure the authorized_keys file is set to the right perms.<br />
<code><span>~/.ssh $></span>chmod 640 authorized_keys2 &#038;&#038; rm id_dsa.pub</code></p>
<p>That should make your life a bit more convenient <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/nix/osx-terminal-niceties-for-remote-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

