<?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>Yet Another Linux Blog &#187; color</title>
	<atom:link href="http://linux-blog.org/tag/color/feed/" rel="self" type="application/rss+xml" />
	<link>http://linux-blog.org</link>
	<description>Open Source, Open Blog</description>
	<lastBuildDate>Fri, 03 Feb 2012 14:33:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Adding Color to Bash List Command Part II</title>
		<link>http://linux-blog.org/adding-color-to-bash-list-command-part-ii/</link>
		<comments>http://linux-blog.org/adding-color-to-bash-list-command-part-ii/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 18:25:16 +0000</pubDate>
		<dc:creator>devnet</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">http://linux-blog.org/?p=1209</guid>
		<description><![CDATA[I previously blogged about how to add color to the &#8216;ls&#8217; command utilizing an config file and alias.  I then stumbled across a nugget of wisdom from a Foresight Linux user on the developers mailing list who gave a handy command that remedies some problems with missing color in a terminal. On some distributions, the [...]]]></description>
			<content:encoded><![CDATA[<p>I <a href="http://linux-blog.org/adding-color-to-bash-list-command/" target="_blank">previously blogged about how to add color to the &#8216;ls&#8217; command</a> utilizing an config file and alias.  I then stumbled across a nugget of wisdom from a Foresight Linux user on the developers mailing list who gave a handy command that remedies some problems with missing color in a terminal.</p>
<p>On some distributions, the system-wide <em>/etc/DIR_COLORS</em>* files are removed or not present.  This results in no colors being given inside of a terminal when looking for color directories and filenames.  If you find yourself in this boat, try the following command to re-populate this setting:</p>
<pre class="brush: bash; title: ; notranslate">devnet-&gt; cd ~/
devnet-&gt; dircolors -p &gt;.dircolors
</pre>
<p>This should create a default profile for colors for your session if it hasn&#8217;t been done or was accidentally removed.  For more information on the dircolors command try &#8216;man dircolors&#8217;.  Please also note that <em>dircolors</em> command uses the environmental variable LS_COLORS to set your session.</p>
<p>For more information on LS_COLORS and how it pertains to the terminal/shell/cli/prompt, there are a few blog posts that do an excellent job explaining <a href="http://twistedcode.blogspot.com/2008/04/lscolors-explained.html" target="_blank">here</a>, <a href="http://linux-sxs.org/housekeeping/lscolors.html" target="_blank">here</a> and <a href="http://www.bigsoft.co.uk/blog/index.php/2008/04/11/configuring-ls_colors" target="_blank">here</a>.</p>
<p><a href="http://linux-blog.org/adding-color-to-bash-list-command-part-ii/" rel="bookmark">Adding Color to Bash List Command Part II</a> originally appeared on <a href="http://linux-blog.org">Yet Another Linux Blog</a> on September 8, 2009.</p>
]]></content:encoded>
			<wfw:commentRss>http://linux-blog.org/adding-color-to-bash-list-command-part-ii/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Adding Color to Bash List Command</title>
		<link>http://linux-blog.org/adding-color-to-bash-list-command/</link>
		<comments>http://linux-blog.org/adding-color-to-bash-list-command/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 21:00:06 +0000</pubDate>
		<dc:creator>devnet</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">http://linux-blog.org/?p=1067</guid>
		<description><![CDATA[One of the things I love is being able to enter into a directory via terminal, list the contents, and quickly see which ones are executable or not and which ones are directories or are not directories IN COLOR (not everyone is perfect right?).  This is specifically handy as I move through working with Slackware [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things I love is being able to enter into a directory via terminal, list the contents, and quickly see which ones are executable or not and which ones are directories or are not directories IN COLOR (not everyone is perfect right?).  This is specifically handy as I move through working with <a href="http://slackware.com">Slackware</a> based distributions like the one I&#8217;m using now, <a href="http://zenwalk.org">Zenwalk</a> Linux 6 and the <em>/etc/rc.d/</em> directory.  Most of the Red Hat based distributions out there that I&#8217;ve used have this set automatically&#8230;so I&#8217;m used to it.  When I opened up a terminal in Zenwalk I found no color. A quick investigation of <em>~/.bashrc</em> showed me that there are aliases set to display color&#8230;instead of ls I&#8217;d just use the letter L; 2 l&#8217;s for another option, 3 for another.  It&#8217;s interesting, but not normally how I do business.  See bashrc below:</p>
<pre class="brush: bash; highlight: [2,3,4]; title: ; notranslate">
devnet[~]$ cat ~/.bashrc
alias lll=&quot;ls -al --color&quot;
alias ll=&quot;ls -l --color&quot;
alias l='ls --color'&lt;br /&gt;alias search='find . -name'
alias aterm=&quot;aterm -fg white -tr&quot;
alias version='cat /etc/zenwalk-version'
alias dh='df -h'&lt;br /&gt;export PS1='\u[\W]\$ '
export PAGER=&quot;most&quot;&lt;br /&gt;devnet[~]$
</pre>
<p>I don&#8217;t use those aliases much&#8230;others of you might do the &#8216;ll&#8217; or &#8216;lll&#8217; but it&#8217;s just not part of my routine.  So, I added in just after line 4 in the code above:</p>
<pre class="brush: bash; title: ; notranslate">
alias ls='ls --color'
</pre>
<p>You can do this a few different ways&#8230;with any command line editor like emacs, vi, or nano/pico.  It&#8217;s really up to you.  The easiest way for new users is to use a text editor:</p>
<pre class="brush: bash; title: ; notranslate">
devnet[~]$ mousepad ~/.bashrc
</pre>
<p>This will launch the mousepad text editor in XFCE.  If you&#8217;re in Gnome, try gedit.  If KDE, give kwrite a try.  You should see something like the following window pop up for editing:</p>
<p style="text-align: left;"><a href="http://linux-blog.org/wp-content/uploads/2009/06/bashrc.png"><img class="aligncenter size-full wp-image-1084" style="rel=&quot;lightbox&quot;" title="bashrc" src="http://linux-blog.org/wp-content/uploads/2009/06/bashrc.png" alt="bashrc" width="188" height="131" /></a>You should see in the picture above, I&#8217;ve added in the alias needed to make me comfortable.  After that, File &gt;&gt; Save.  You&#8217;re set!  Except, you may notice that when you type the command &#8216;ls&#8217; there are no colors.  So what gives?  Well, we haven&#8217;t loaded our <em>./bashrc</em> since we changed it.  You don&#8217;t have to logout and back in to get things to work though&#8230;you can do this right from the terminal:</p>
<pre class="brush: bash; title: ; notranslate">
devnet[~]$ exec bash
</pre>
<p>Now try giving the &#8216;ls&#8217; command a try again and you should see that it is in color.  I know a lot of the more advanced Linux guys out there are probably saying, &#8220;why&#8217;d he waste a post on this!  It&#8217;s easy&#8221; and you&#8217;d be right for a majority of users out there&#8230;I hope that this post finds some new user out there that may be stuck for an answer on how to do this.  One final note on this as well: You will have to do this as the root user and change <em>/root/.bashrc</em> in order for your root user to also have color.  Thanks for reading!<br />
<script type="text/javascript">// < ![CDATA[
google_ad_client = "pub-3982453702542240";
/* 468x15, created 6/24/09 */
google_ad_slot = "6181047080";
google_ad_width = 468;
google_ad_height = 15;
// ]]&gt;</script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">
</script></p>
<p><a href="http://linux-blog.org/adding-color-to-bash-list-command/" rel="bookmark">Adding Color to Bash List Command</a> originally appeared on <a href="http://linux-blog.org">Yet Another Linux Blog</a> on June 5, 2009.</p>
]]></content:encoded>
			<wfw:commentRss>http://linux-blog.org/adding-color-to-bash-list-command/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

