<?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>geek scrap &#187; freebsd</title>
	<atom:link href="http://geekscrap.com/tags/freebsd/feed/" rel="self" type="application/rss+xml" />
	<link>http://geekscrap.com</link>
	<description>there is at least one way to do it</description>
	<lastBuildDate>Tue, 12 Apr 2011 10:14:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Gentooize Part 1: colorize console</title>
		<link>http://geekscrap.com/2010/01/gentooize-part-1-colorize-console/</link>
		<comments>http://geekscrap.com/2010/01/gentooize-part-1-colorize-console/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 07:30:40 +0000</pubDate>
		<dc:creator>geekscrap</dc:creator>
				<category><![CDATA[How-tos]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[colors]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ls]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[prompt]]></category>

		<guid isPermaLink="false">http://geekscrap.com/?p=137</guid>
		<description><![CDATA[One of the best lessons you can learn from Gentoo is you can export most of its juice to other OSes. I&#8217;ve been using Gentoo as main Linux distro since 2001. Currently I have a few setups where drawbacks of migrating to Gentoo would exceed benefits, so I decided to increase affinity by adding some [...]]]></description>
			<content:encoded><![CDATA[<p>One of the best lessons you can learn from Gentoo is you can <em>export</em> most of its juice to other OSes. I&#8217;ve been using Gentoo as main Linux distro since 2001. Currently I have a few setups where drawbacks of migrating to Gentoo would exceed benefits, so I decided to increase affinity by adding some Gentoo look&#8217;n'feel. This week I will post some tips to setup Gentoo console colors on other operating systems.</p>
<p><span id="more-137"></span></p>
<h2>Shell prompt</h2>
<p>First of all, you should check you&#8217;re using <strong>bash</strong> shell:</p>
<pre lang="bash">$ env | grep ^SHELL=
SHELL=/bin/bash</pre>
<p>If not, you should check if bash package is already installed. If it&#8217;s already there, just change your user shell (and possibly root shell) with chsh or consult your OS manual. <strong>Be careful</strong>: if bash is not listed in /etc/shells, you might lock yourself out.</p>
<p>To set Gentoo-like colors on bash prompt, edit ~/.profile (or /etc/profile for system-wide defaults) and add the following:</p>
<pre lang="bash">if [[ ${EUID} == 0 ]] ; then
        PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
else
        PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
fi</pre>
<h2>GNU ls</h2>
<p>If you use GNU ls (use &#8211;version to check) and <strong>dircolors</strong> utility is available (from GNU <a rel="nofollow" href="http://www.gnu.org/software/coreutils/">coreutils</a>), you can have colorful outputs by adding the following snippet to your bash profile (see above):</p>
<pre lang="bash">if type -P dircolors &gt;/dev/null ; then
        if [[ -f ~/.dir_colors ]] ; then
                eval $(dircolors -b ~/.dir_colors)
        elif [[ -f /etc/DIR_COLORS ]] ; then
                eval $(dircolors -b /etc/DIR_COLORS)
        fi
fi
alias ls='ls --color=auto'</pre>
<p>To enable colors, you need to save Gentoo <a href="http://geekscrap.com/wp-content/uploads/2010/01/DIR_COLORS">color defs</a> to ~/.dir_colors (or /etc/DIR_COLORS for system-wide defaults).<br />
Alternatively, if you miss dircolors binary on your system, save output from dircolors on a Gentoo machine and copy&#8217;n'paste it into bash profile:</p>
<pre lang="bash">LS_COLORS='...weird colon-separated string...'
export LS_COLORS
alias ls='ls --color=auto'</pre>
<h2>BSD ls implementation</h2>
<p>A special trick is required for <strong>FreeBSD</strong> and <strong>Mac OS X</strong>: add the following line to your bash profile:</p>
<pre lang="bash">export CLICOLOR=1 LSCOLORS="ExGxFxDxCxDxDxhbhdacEc"</pre>
<p>If you want to further customize colors on your <strong>Mac OS X Terminal</strong>, you can use SIMBL <a rel="nofollow" href="http://ciaranwal.sh/2007/11/01/customising-colours-in-leopard-terminal">TerminalColours</a> plugin (<a rel="nofollow" href="http://blog.fallingsnow.net/2009/08/28/fixing-colors-in-terminal-app-on-10-6/">Snow Leopard version</a>).</p>
<h2>GNU grep</h2>
<p>You can enable coloring of the matched part by appending the following alias to your bash profile:</p>
<pre lang="bash">alias grep='grep --colour=auto'</pre>
<p>As usual, if you have any coloring tips&#8217;n'tricks you want to share, please use the comment box below.</p>
]]></content:encoded>
			<wfw:commentRss>http://geekscrap.com/2010/01/gentooize-part-1-colorize-console/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
