<?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>Napolitopia.com &#187; Unix Pie</title>
	<atom:link href="http://www.napolitopia.com/category/unix-pie/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.napolitopia.com</link>
	<description>Someday Came Suddenly</description>
	<lastBuildDate>Tue, 27 Jul 2010 16:50:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>LSCOLORS in OSX Snow Leopard, For Dummies</title>
		<link>http://www.napolitopia.com/2010/03/lscolors-in-osx-snow-leopard-for-dummies/</link>
		<comments>http://www.napolitopia.com/2010/03/lscolors-in-osx-snow-leopard-for-dummies/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 19:23:41 +0000</pubDate>
		<dc:creator>eightamrock</dc:creator>
				<category><![CDATA[Code Bin]]></category>
		<category><![CDATA[Unix Pie]]></category>

		<guid isPermaLink="false">http://www.napolitopia.com/?p=49</guid>
		<description><![CDATA[So after cruising the web for a few hours trying to find &#8216;dummy&#8217; style documentation on changing colors in terminal using .bashrc, I finally stumbled across a site that got me half way there. After playing around a bit I found a few little tricks and things that no one really likes to share. So [...]]]></description>
			<content:encoded><![CDATA[<p>So after cruising the web for a few hours trying to find &#8216;dummy&#8217; style documentation on changing colors in terminal using .bashrc, I finally stumbled across a site that got me half way there. After playing around a bit I found a few little tricks and things that no one really likes to share. So here it is.</p>
<p><span id="more-49"></span></p>
<h2>LSCOLORS A bash Command</h2>
<p>The first thing you should know is that this is not as straight forward as most people like to make you believe. I am a total n00b when it comes to bash so I really need to start at the beginning.</p>
<p><strong>Step 1: Make sure .bashrc is being used by terminal</strong></p>
<p>This is the easiest step. In terminal navigate to your home directory. This is usually accomplished by typing &#8216;<em>cd ~</em>&#8216; and executing. Then do a quick directory listing showing all hidden files &#8216;<em>ls -al</em>&#8216;. Once you do this, you should see both a &#8216;<em>.bashrc</em>&#8216; and a &#8216;<em>.bash_profile</em>&#8216;. If you don&#8217;t, no need to panic we can create them easily and Snow Leopard is smart enough to know what to do with them.  So if they don&#8217;t exist, execute these 2 commands in terminal &#8216;<em>touch .bashrc</em>&#8216; &#8216;<em>touch .bash_profile</em>&#8216;. If you re-run your &#8216;<em>ls -al</em>&#8216; again you should now see the files.</p>
<p><strong>Step 2: Link .bashrc to .bash_profile</strong></p>
<p>Using your favorite editor, in my case Textmate, open<em> &#8216;.bash_profile&#8217;</em>. This file needs one line.</p>
<pre class="brush:bash">source ~/.bashrc</pre>
<p><strong>Update</strong>: A good friend of mine at <a href="http://blog.ubrio.us" target="_blank">blog.ubrio.us</a> just gave me the scoop on &#8216;<em>bashrc</em>&#8216; vs &#8216;<em>bash_profile</em>&#8216;. The gist of it is that <em>bashrc</em> is read when you open a new tab in terminal locally and <em>bash_profile</em> is read when you are SSHing into the environment. So choose whichever works for you. I just link them because I want the same view no matter how I am connecting.</p>
<p>Next open the <em>&#8216;.bashrc</em>&#8216; file, this is where we can have some fun.</p>
<p><strong>Step 3: Colors LSColors and more LS_Colors</strong>&#8230;</p>
<p>The first thing we have to do is prepare bash to receive the colors, in order to do that you need to enter these 3 lines.</p>
<pre class="brush:bash">export LS_OPTIONS='--color=auto'
export CLICOLOR='Yes'
export LSCOLORS=''
</pre>
<p>This should be pretty straight forward, we are exporting the LS_OPTIONS and saying to use colors and to automatically choose them for us if I have not chosen them. CLICOLOR=&#8217;YES&#8217; is telling bash to force color output and LS_COLORS is where we will start to define our scheme.</p>
<p>Here are the colors that are available:</p>
<ul>
<li> a = black</li>
<li>b = red</li>
<li>c = green</li>
<li>d = brown</li>
<li>e = blue</li>
<li>f = magenta</li>
<li>g = cyan</li>
<li>h = light gray</li>
<li>x = default</li>
</ul>
<p>It is important to note how the color codes pair up. Basically each entry will be a Foreground | Background pair. so &#8216;<em>ex</em>&#8216; means foreground blue background default. The &#8216;default&#8217; color will be whatever you have set in your command line app&#8217;s preferences. Most default to a white background and black foreground. By simply upper-casing any of the color codes you can bold your text, this really on works on foregrounds. Example: Bx means bold red foreground and default background.</p>
<p>The next thing that I found difficult to find was how these color codes were ordered. So it&#8217;s like this&#8230;.</p>
<ol>
<li>DIR</li>
<li>SYM_LINK</li>
<li>SOCKET</li>
<li>PIPE</li>
<li>EXE</li>
<li>BLOCK_SP</li>
<li>CHAR_SP</li>
<li>EXE_SUID</li>
<li>EXE_GUID</li>
<li>DIR_STICKY</li>
<li>DIR_WO_STICKY</li>
</ol>
<p>Wow that&#8217;s a lot, but that&#8217;s the order..</p>
<p><strong>Step 4: Putting it all together</strong></p>
<p>So now you have the order and you have the colors, lets put it all together. I use a default background of black and a foreground of white, so I use a lot of default color settings.</p>
<pre class="brush:bash">export LSCOLORS='Bxgxfxfxcxdxdxhbadbxbx'
</pre>
<p>Here is the break down:</p>
<ol>
<li>DIR = Bx #Bold red text with default background</li>
<li>SYM_LINK = gx #cyan text with default background</li>
<li>SOCKET = fx #magenta text with default background</li>
<li>PIPE = fx #magenta text with default background</li>
<li>EXE = cx #green text with default background</li>
<li>BLOCK_SP = dx #brown text with default background</li>
<li>CHAR_SP = dx #brown text with default background</li>
<li>EXE_SUID = hb #light grey text with red background</li>
<li>EXE_GUID = ad #black text with brown background</li>
<li>DIR_STICKY = bx #red text with default background</li>
<li>DIR_WO_STICKY = bx #red text with default background</li>
</ol>
<p><strong>Step 5: Wrap UP</strong></p>
<p>So your done, save your bash files and restart terminal. You should now have colors.</p>
<p>Well that&#8217;s it, I hope this helps you figure out your bash color profile: :) cheers!</p>
<p class="tweet_align"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@eightamrock+LSCOLORS+in+OSX+Snow+Leopard%2C+For+Dummies+http://tinyurl.com/y8s3m72" title="Post to Twitter"><img class="nothumb" src="http://www.napolitopia.com/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://twitter.com/home/?status=@eightamrock+LSCOLORS+in+OSX+Snow+Leopard%2C+For+Dummies+http://tinyurl.com/y8s3m72" title="Post to Twitter">Tweet This!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.napolitopia.com/2010/03/lscolors-in-osx-snow-leopard-for-dummies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up a localhost subdomain in OS X Leopard (Made Easy)</title>
		<link>http://www.napolitopia.com/2010/01/setting-up-a-localhost-subdomain-in-os-x-leopard-made-easy/</link>
		<comments>http://www.napolitopia.com/2010/01/setting-up-a-localhost-subdomain-in-os-x-leopard-made-easy/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 05:41:04 +0000</pubDate>
		<dc:creator>eightamrock</dc:creator>
				<category><![CDATA[Unix Pie]]></category>

		<guid isPermaLink="false">http://www.napolitopia.com/wp_proof/?p=7</guid>
		<description><![CDATA[Hello All, its been a while since I made an update and I am really only posting this because I keep forgetting what files to modify when I go to setup a new localhost subdomain.]]></description>
			<content:encoded><![CDATA[<p>Hello All, its been a while since I made an update and I am really only posting this because I keep forgetting what files to modify when I go to setup a new localhost subdomain.</p>
<p><span id="more-7"></span></p>
<p>So here it is..</p>
<p>Step 1) Setup your new subdomain path as a virtual directory in apache. This file lives at /etc/apache2/other/httpd-vhosts.conf</p>
<p>Add an entry..</p>
<p><code> DocumentRoot "/wwwroot/yoursubdomainpath/"<br />
ServerName yoursubdomain.localhost</code></p>
<p>This should immediately follow the virtual host setup for localhost.</p>
<p>Step 2) Add an entry to your hosts file located at /etc/hosts</p>
<p>It probably looks like this to start.</p>
<p><code>##<br />
# Host Database<br />
#<br />
# localhost is used to configure the loopback interface<br />
# when the system is booting.  Do not change this entry.<br />
##<br />
127.0.0.1    localhost<br />
255.255.255.255    broadcasthost<br />
::1             localhost<br />
fe80::1%lo0    localhost</code></p>
<p>Just add this line to the end of the file.. It is important to know that it is tab delimited not spaces.</p>
<p><code>127.0.0.1   yoursubdomain.localhost</code></p>
<p>The only other thing you may need to do if it wasn&#8217;t already done is uncomment this line in your /etc/apache2/httpd.conf file</p>
<p><code>Include /private/etc/apache2/extra/httpd-vhosts.conf</code></p>
<p>It lives around line 461</p>
<p>Thats it! Restart apache and yoursubdomain.local host now works.</p>
<p class="tweet_align"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@eightamrock+Setting+up+a+localhost+subdomain+in+OS+X+Leopard+%28Made+Easy%29+http://tinyurl.com/ycmgbkf" title="Post to Twitter"><img class="nothumb" src="http://www.napolitopia.com/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://twitter.com/home/?status=@eightamrock+Setting+up+a+localhost+subdomain+in+OS+X+Leopard+%28Made+Easy%29+http://tinyurl.com/ycmgbkf" title="Post to Twitter">Tweet This!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.napolitopia.com/2010/01/setting-up-a-localhost-subdomain-in-os-x-leopard-made-easy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
