<?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>Geekality &#187; Unix</title>
	<atom:link href="http://www.geekality.net/tag/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geekality.net</link>
	<description>With a hint of Social Ineptitude</description>
	<lastBuildDate>Sun, 05 Feb 2012 17:53:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Getting a GUI in Ubuntu Server</title>
		<link>http://www.geekality.net/2011/08/12/getting-a-gui-in-ubuntu-server/</link>
		<comments>http://www.geekality.net/2011/08/12/getting-a-gui-in-ubuntu-server/#comments</comments>
		<pubDate>Fri, 12 Aug 2011 14:12:49 +0000</pubDate>
		<dc:creator>Torleif</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.geekality.net/?p=1777</guid>
		<description><![CDATA[Wanted to try out Ubuntu Server, but with a GUI. You can get a GUI by running: $ sudo apt-get install ubuntu-desktop However, then you will get the whole thing. This means it will also include all those applications and &#8230; <a href="http://www.geekality.net/2011/08/12/getting-a-gui-in-ubuntu-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Wanted to try out Ubuntu Server, but with a GUI.</p>
<p><span id="more-1777"></span></p>
<p>You can get a GUI by running:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> ubuntu-desktop</div></div>
<p>However, then you will get the whole thing. This means it will also include all those applications and games that Ubuntu Desktop comes with. Don&#8217;t want that. You can get a much slimmer version by running:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #660033;">--without-recommends</span> ubuntu-desktop</div></div>
<p>In both cases, reboot when it&#8217;s done and it should boot into the regular desktop environment.</p>
<h3>Administrator password</h3>
<p>For some reason, you won&#8217;t be able to access the Synaptic Package Manager, or add package sources in the Software Center thing (or what it was called) until you have set a root password. When you open these it doesn&#8217;t ask you for authorization like other administration stuff does, but for the administrator password. I don&#8217;t know why this happens (can&#8217;t recall it happening when using regular Ubuntu Desktop), but you can set the root password if you open up a terminal and run:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">passwd</span> root</div></div>
<p>If someone has an explanation to why this happens in Ubuntu Server and not in Ubuntu Desktop, I would like to hear about it!</p>
<p class="wp-flattr-button"></p> <p><a href="http://www.geekality.net/?flattrss_redirect&amp;id=1777&amp;md5=b2a75d1cc9358f15319fa986afcd1f69" title="Flattr" target="_blank"><img src="http://www.geekality.net/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.geekality.net/2011/08/12/getting-a-gui-in-ubuntu-server/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Unix: Recursive search for text in files</title>
		<link>http://www.geekality.net/2011/04/12/unix-recursive-search-for-text-in-files/</link>
		<comments>http://www.geekality.net/2011/04/12/unix-recursive-search-for-text-in-files/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 18:51:58 +0000</pubDate>
		<dc:creator>Torleif</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Command line]]></category>
		<category><![CDATA[Grep]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.geekality.net/?p=1547</guid>
		<description><![CDATA[Keep forgetting how to do this, so here it is. How to do a quick and simple, recursive search for text using grep. Hint: It&#8217;s very simple. $ grep -rl &#34;some text&#34; . That&#8217;s all there is to it! grep &#8230; <a href="http://www.geekality.net/2011/04/12/unix-recursive-search-for-text-in-files/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_1549" class="wp-caption alignright" style="width: 310px"><img src="http://www.geekality.net/wp-content/uploads/2011/04/Sunsets-and-Silhouttes-300x168.jpg" alt="Silhouette of a person with binoculars against a sunset" title="Sunsets and Silhouttes" width="300" height="168" class="size-medium wp-image-1549" /><p class="wp-caption-text">rgbstock.com</p></div>Keep forgetting how to do this, so here it is. How to do a quick and simple, recursive search for text using <code class="codecolorer text default"><span class="text">grep</span></code>. Hint: It&#8217;s very simple.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-rl</span> <span style="color: #ff0000;">&quot;some text&quot;</span> .</div></div>
<p>That&#8217;s all there is to it! <code class="codecolorer text default"><span class="text">grep</span></code> is the command, <code class="codecolorer text default"><span class="text">r</span></code> makes the search recursive (i.e. in the target folder and all its sub-folders), <code class="codecolorer text default"><span class="text">l</span></code> means it will list the name of all the files where it finds the text, <code class="codecolorer text default"><span class="text">&quot;some text&quot;</span></code> is the string to search for, and finally, the dot at the end means to start the search in the current directory. And just to clarify, this searches for text <em>inside</em> of files, in the content of the files; not the filenames.</p>
<p>There, now I know where to find it when I forget it next time. And perhaps I have helped someone else too <img src='http://www.geekality.net/wp-includes/images/blank.gif' alt=':)' class='wp-smiley smiley-1' /> </p>
<p>Good night!</p>
<p class="wp-flattr-button"></p> <p><a href="http://www.geekality.net/?flattrss_redirect&amp;id=1547&amp;md5=11e1910d2f571641376ff58c5b44a318" title="Flattr" target="_blank"><img src="http://www.geekality.net/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.geekality.net/2011/04/12/unix-recursive-search-for-text-in-files/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to make the Bash command prompt more useful</title>
		<link>http://www.geekality.net/2011/02/17/how-to-make-the-bash-command-prompt-more-useful/</link>
		<comments>http://www.geekality.net/2011/02/17/how-to-make-the-bash-command-prompt-more-useful/#comments</comments>
		<pubDate>Thu, 17 Feb 2011 19:21:56 +0000</pubDate>
		<dc:creator>Torleif</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Command line]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.geekality.net/?p=1483</guid>
		<description><![CDATA[Was on a Linux box today and I found the command prompt rather useless. It looked like this: -bash-3.2$ I know I&#8217;m using bash, and I don&#8217;t really care about the version. Or that I&#8217;m using bash actually&#8230; But anyways, &#8230; <a href="http://www.geekality.net/2011/02/17/how-to-make-the-bash-command-prompt-more-useful/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Was on a Linux box today and I found the command prompt rather useless. It looked like this:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">-bash-3.2$</div></div>
<p>I know I&#8217;m using bash, and I don&#8217;t really care about the version. Or that I&#8217;m using bash actually&#8230; But anyways, to make it more useful you can run this:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;\u@\h:\w$ &quot;</span></div></div>
<p>You will then get a prompt which contains your username, hostname and current working directory. <em>Much</em> more useful in my opinion. If you have a different opinion, please share <img src='http://www.geekality.net/wp-includes/images/blank.gif' alt=':)' class='wp-smiley smiley-1' /> </p>
<p>You can find more stuff to put in your prompt by reading the prompting section of the <a href="http://linux.die.net/man/1/bash">bash man page</a>.</p>
<p class="wp-flattr-button"></p> <p><a href="http://www.geekality.net/?flattrss_redirect&amp;id=1483&amp;md5=de5b63b047f95d04844d44a1c8745ac5" title="Flattr" target="_blank"><img src="http://www.geekality.net/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.geekality.net/2011/02/17/how-to-make-the-bash-command-prompt-more-useful/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to set JAVA_HOME and where is whereis on Solaris?</title>
		<link>http://www.geekality.net/2011/02/02/how-to-set-java_home-and-where-is-whereis-on-solaris/</link>
		<comments>http://www.geekality.net/2011/02/02/how-to-set-java_home-and-where-is-whereis-on-solaris/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 16:41:50 +0000</pubDate>
		<dc:creator>Torleif</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.geekality.net/?p=1466</guid>
		<description><![CDATA[To set the JAVA_HOME environment variable you first need to find where your Java installation is located and then set it somehow. How to find it $ whereis java /usr/bin/java $ ls -l /usr/bin/java lrwxrwxrwx ... /usr/bin/java -&#62; ../java/bin/java First &#8230; <a href="http://www.geekality.net/2011/02/02/how-to-set-java_home-and-where-is-whereis-on-solaris/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>To set the <code class="codecolorer text default"><span class="text">JAVA_HOME</span></code> environment variable you first need to find where your Java installation is located and then set it somehow.</p>
<p><span id="more-1466"></span></p>
<h2>How to find it</h2>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">whereis</span> java<br />
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java<br />
$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java<br />
lrwxrwxrwx ... <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java -<span style="color: #000000; font-weight: bold;">&gt;</span> ..<span style="color: #000000; font-weight: bold;">/</span>java<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java</div></div>
<p>First command figures out where the java command is located. We then use <code class="codecolorer text default"><span class="text">ls -l</span></code> and finds that <code class="codecolorer text default"><span class="text">/usr/bin/java</span></code> actually points to <code class="codecolorer text default"><span class="text">../java/bin/java</span></code>. As an absolute path, that would be <code class="codecolorer text default"><span class="text">/usr/java/bin/java</span></code>. This means our <code class="codecolorer text default"><span class="text">JAVA_HOME</span></code> should be set to <code class="codecolorer text default"><span class="text">/usr/java</span></code>.</p>
<p>(I have assumed that Java actually is installed. If it isn&#8217;t, you need to do that first)</p>
<h3>But where is whereis?</h3>
<p>The above example is how it normally goes for me on for example Ubuntu (although the directory you get might be different). However, this is what happened when I did it on a machine running SunOS 5.10:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">whereis</span> java<br />
-bash: whereis: <span style="color: #7a0874; font-weight: bold;">command</span> not found</div></div>
<p><a href="http://www.thegeekstuff.com/2010/11/50-linux-commands/" title="Link to source (a comment to the blog post)">Turns out</a> that command doesn&#8217;t exist on Solaris. Luckily we can use a command called <code class="codecolorer text default"><span class="text">which</span></code> instead, which gives you the same result.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">which</span> java<br />
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java</div></div>
<h3>But I want to use whereis!</h3>
<p>Well, <a href="http://www.kickstartlinux.com/2007/12/enable-whereis-command-on-solaris/" title="Link to source" class="broken_link">turns out you can</a>! Apparently the command actually <em>does</em> exist. It&#8217;s just not in your path by default. This command (and some others) can be found in <code class="codecolorer text default"><span class="text">/usr/ucb</span></code>, so we just need to add that to our <code class="codecolorer text default"><span class="text">PATH</span></code> and we can use it like normal.</p>
<h2>How to set it</h2>
<p>There are various ways of doing this, and in my case the simplest way was to add the lines below to a file called <code class="codecolorer text default"><span class="text">~/.profile</span></code>.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">JAVA_HOME</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>java<br />
<span style="color: #7a0874; font-weight: bold;">export</span> JAVA_HOME<br />
<br />
<span style="color: #007800;">PATH</span>=<span style="color: #007800;">$PATH</span>:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>ucb<br />
<span style="color: #7a0874; font-weight: bold;">export</span> PATH</div></div>
<p>The last two lines shows how to add <code class="codecolorer text default"><span class="text">/usr/ucb</span></code> to your path, which you can skip if you don&#8217;t feel a great need to use <code class="codecolorer text default"><span class="text">whereis</span></code> later.</p>
<p class="wp-flattr-button"></p> <p><a href="http://www.geekality.net/?flattrss_redirect&amp;id=1466&amp;md5=873b4ce6f69141a2b6bef22ae8336341" title="Flattr" target="_blank"><img src="http://www.geekality.net/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.geekality.net/2011/02/02/how-to-set-java_home-and-where-is-whereis-on-solaris/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to ignore &#8220;find: cannot read dir /foo: Permission denied&#8221;</title>
		<link>http://www.geekality.net/2011/02/02/how-to-ignore-find-cannot-read-dir-foo-permission-denied/</link>
		<comments>http://www.geekality.net/2011/02/02/how-to-ignore-find-cannot-read-dir-foo-permission-denied/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 13:13:38 +0000</pubDate>
		<dc:creator>Torleif</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[Find]]></category>
		<category><![CDATA[Pipelining]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.geekality.net/?p=1477</guid>
		<description><![CDATA[If you run the following command on a Unix system you might see a lot of errors. $ find / -name &#34;tar&#34; In my case I got 8 regular findings and 63 lines of &#8220;find: cannot read dir /foo: Permission &#8230; <a href="http://www.geekality.net/2011/02/02/how-to-ignore-find-cannot-read-dir-foo-permission-denied/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you run the following command on a Unix system you might see a lot of errors.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;tar&quot;</span></div></div>
<p>In my case I got 8 regular findings and 63 lines of &#8220;find: cannot read dir /foo: Permission denied&#8221;. Quite a lot of noise I really don&#8217;t care about. Using my new knowledge about streams it is easy to get rid of all that though. Just pipe stderr into <code class="codecolorer text default"><span class="text">/dev/null</span></code>.</p>
<p><span id="more-1477"></span></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;tar&quot;</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null</div></div>
<p>Voila. Clean output.</p>
<p> <img src='http://www.geekality.net/wp-includes/images/blank.gif' alt=':?:' class='wp-smiley smiley-23' /> Remember that when you do this <em>all</em> errors will be sent to nowhere. So if there was any other errors, they would also be gone. In this case I don&#8217;t care, but in other instances you might want to do something else. For example direct it to a log file rather than to oblivion.</p>
<p class="wp-flattr-button"></p> <p><a href="http://www.geekality.net/?flattrss_redirect&amp;id=1477&amp;md5=2bcfecf67db7c9e80a42fead3a5b3d90" title="Flattr" target="_blank"><img src="http://www.geekality.net/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.geekality.net/2011/02/02/how-to-ignore-find-cannot-read-dir-foo-permission-denied/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Unix: How to redirect stderr to stdout</title>
		<link>http://www.geekality.net/2011/02/02/unix-how-to-redirect-stderr-to-stdout/</link>
		<comments>http://www.geekality.net/2011/02/02/unix-how-to-redirect-stderr-to-stdout/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 12:52:10 +0000</pubDate>
		<dc:creator>Torleif</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Command]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.geekality.net/?p=1473</guid>
		<description><![CDATA[Today I ran a Java application in a Unix console. It printed out some messages before it crashed with an exception and a loong stack trace. Too long to see the top of. So, I figured I&#8217;d just pipeline it &#8230; <a href="http://www.geekality.net/2011/02/02/unix-how-to-redirect-stderr-to-stdout/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today I ran a Java application in a Unix console. It printed out some messages before it crashed with an exception and a loong stack trace. Too long to see the top of. So, I figured I&#8217;d just <a href="http://en.wikipedia.org/wiki/Pipeline_(Unix)">pipeline</a> it into the lovely <code class="codecolorer text default"><span class="text">less</span></code> like this:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span>java <span style="color: #660033;">-jar</span> foobar.jar <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">less</span></div></div>
<p>The result was not what I expected however. All I got to see was the messages that had been printed out. No exception or stack trace to be seen.</p>
<p><span id="more-1473"></span></p>
<p>The reason for this is quite simply that a Unix process has three different <a href="http://en.wikipedia.org/wiki/Standard_streams">streams</a>: stdin(0), stdout(1) and stderr(2). When we pipe output from one process into another we sort of connect stdout of the first one to stdin of the second.</p>
<p>So, to be able to see my giant stack trace, we can for example redirect stderr to stdout. This way we will get both streams into stdin of the next process.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span>java <span style="color: #660033;">-jar</span> foobar.jar <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">less</span></div></div>
<p>Fancy, huh? We can also direct these streams into files, which might come in handy.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span>java <span style="color: #660033;">-jar</span> foobar.jar <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">&gt;</span>out.log <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;</span>err.log</div></div>
<p>If you want the output to be appended to the log files instead of replacing them, you can do adjust the command to this:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span>java <span style="color: #660033;">-jar</span> foobar.jar <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">&gt;&gt;</span>out.log <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&gt;</span>err.log</div></div>
<p> <img src='http://www.geekality.net/wp-includes/images/blank.gif' alt=':)' class='wp-smiley smiley-1' /> </p>
<p class="wp-flattr-button"></p> <p><a href="http://www.geekality.net/?flattrss_redirect&amp;id=1473&amp;md5=345a2ba043a55f0bdf321592159cc850" title="Flattr" target="_blank"><img src="http://www.geekality.net/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.geekality.net/2011/02/02/unix-how-to-redirect-stderr-to-stdout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to enable verbose booting in Mac OS X</title>
		<link>http://www.geekality.net/2010/05/12/how-to-enable-verbose-booting-in-mac-os-x/</link>
		<comments>http://www.geekality.net/2010/05/12/how-to-enable-verbose-booting-in-mac-os-x/#comments</comments>
		<pubDate>Wed, 12 May 2010 07:41:52 +0000</pubDate>
		<dc:creator>Torleif</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Command line]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.geekality.net/?p=979</guid>
		<description><![CDATA[I&#8217;m a curious guy, so I wanted to see if there was anything interesting happening behind the Apple logo when the Mac I use at work boots up. Turned out it was quite simple to enable and disable this feature. &#8230; <a href="http://www.geekality.net/2010/05/12/how-to-enable-verbose-booting-in-mac-os-x/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a curious guy, so I wanted to see if there was anything interesting happening behind the Apple logo when the Mac I use at work boots up.</p>
<p>Turned out it was quite simple to enable and disable this feature. To enable it, just open up a Terminal and run the following command:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">sudo</span> nvram boot-args=<span style="color: #ff0000;">&quot;-v&quot;</span></div></div>
<p>When you reboot the next time, you will see all the fun stuff happening during the boot up. If you get tired of it, you can disable it again by running:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">sudo</span> nvram boot-args=</div></div>
<p>That&#8217;s it!</p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.geekality.net/2010/05/12/how-to-enable-verbose-booting-in-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

