<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>*nix Shell</title>
	<atom:link href="http://nixshell.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://nixshell.wordpress.com</link>
	<description>UNIX / Linux Shell Hints and Tips&#160;&#160;&#160;&#160;&#160;&#160;(a http://steve-parker.org/sh/sh.shtml subproject)</description>
	<lastBuildDate>Sun, 29 Jan 2012 11:18:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='nixshell.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>*nix Shell</title>
		<link>http://nixshell.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://nixshell.wordpress.com/osd.xml" title="*nix Shell" />
	<atom:link rel='hub' href='http://nixshell.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Shell Scripting book &#8211; out now</title>
		<link>http://nixshell.wordpress.com/2011/09/24/shell-scripting-book-out-now/</link>
		<comments>http://nixshell.wordpress.com/2011/09/24/shell-scripting-book-out-now/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 00:08:17 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=201</guid>
		<description><![CDATA[In case you hadn't heard via other channels, my 564-page book, <i>Shell Scripting: Expert Recipes for Linux, Bash and more</i> is on sale now.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=201&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In case you hadn&#8217;t heard via other channels, my 564-page book, <i>Shell Scripting: Expert Recipes for Linux, Bash and more</i> is on sale now.</p>
<p>Paper books:<br />
<a href="http://www.amazon.com/dp/1118024486/ref=as_li_qf_sp_asin_til?tag=steveparkeror-20&amp;camp=14573&amp;creative=327641&amp;linkCode=as1&amp;creativeASIN=1118024486&amp;adid=03791AEZR7KW17HZ81QR&amp;">Amazon USA</a><br />
<a href="http://www.amazon.co.uk/dp/1118024486/ref=as_li_tf_til?tag=steveparkeror-21&amp;camp=1406&amp;creative=6394&amp;linkCode=as1&amp;creativeASIN=1118024486&amp;adid=0J34QQA8JY54S2K2Q5E4&amp;">Amazon UK</a><br />
Also available at Barnes &amp; Noble, WH Smiths, Waterstones, Supermarkets (online, if not in-store), and as the saying goes, every good bookshop (and some others too).</p>
<p>Kindle: <a href="http://www.amazon.com/dp/B005J58LSO/ref=as_li_tf_til?tag=steveparkeror-20&amp;camp=14573&amp;creative=327641&amp;linkCode=as1&amp;creativeASIN=B005J58LSO&amp;adid=0JB9N2PYHY5MY0JRB0PY&amp;">Kindle</a></p>
<p>iPad / etc: <a href="http://itunes.apple.com/gb/book/shell-scripting/id458591992?mt=11&amp;ign-mpt=uo%3D4">iTunes</a></p>
<p>Nook: <a href="http://www.barnesandnoble.com/w/shell-scripting-steve-parker/1103878597?ean=9781118166321&amp;itm=1&amp;usri=shell%2bscripting">Nook</a></p>
<p>There&#8217;s also a Facebook page at <a href="http://facebook.com/shellscript">facebook.com/shellscript</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/201/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=201&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2011/09/24/shell-scripting-book-out-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>Arcade Games written in a Shell Script</title>
		<link>http://nixshell.wordpress.com/2011/07/13/arcade-games-written-in-a-shell-script/</link>
		<comments>http://nixshell.wordpress.com/2011/07/13/arcade-games-written-in-a-shell-script/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 22:08:32 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=194</guid>
		<description><![CDATA[Yes, it is perfectly possible. Do watch this YouTube Video http://www.youtube.com/watch?v=WNPm3aKzPdg Space Invaders &#8211; written entirely in the Bash shell, in a 248-line shell script. The shell is often seen as old hat, hard to use, green screens and no interaction. In my new book, Shell Scripting (http://facebook.com/shellscript), I attempt to throw a new perspective [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=194&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Yes, it is perfectly possible.  Do watch this YouTube Video<br />
<a href="http://www.youtube.com/watch?v=WNPm3aKzPdg">http://www.youtube.com/watch?v=WNPm3aKzPdg</a><br />
<div id="attachment_198" class="wp-caption alignright" style="width: 266px"><a href="http://nixshell.files.wordpress.com/2011/07/space.gif"><img src="http://nixshell.files.wordpress.com/2011/07/space.gif?w=450" alt="Space Game" title="Space Game"   class="size-full wp-image-198" /></a><p class="wp-caption-text">Space Game</p></div><br />
Space Invaders &#8211; written entirely in the Bash shell, in a 248-line shell script.</p>
<p>The shell is often seen as old hat, hard to use, green screens and no interaction. In my new book, Shell Scripting (<a href="http://facebook.com/shellscript">http://facebook.com/shellscript</a>), I attempt to throw a new perspective on this; the shell can be used in lots of creative and imaginative ways.</p>
<p>The book also covers creating CSV files to easily plot complex data in spreadsheets, creating HTML as well as parsing HTML documents; I plan to post more updates before its launch on 12th August 2011.</p>
<p>Shell Scripting by Steve Parker. ISBN 1118024486</p>
<p><a href="http://amzn.com/1118024486">http://amzn.com/1118024486</a><br />
<a href="http://facebook.com/shellscript">http://facebook.com/shellscript</a><br />
<a href="http://sgpit.com/book">http://sgpit.com/book</a></p>
<p>You can get the code for the game <a href="http://media.wiley.com/product_ancillary/86/11180244/DOWNLOAD/Chapter%2017%20code.zip">here</a>. The description and explanation is in the book, of course. But at least the code itself is available online for inspection.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/194/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=194&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2011/07/13/arcade-games-written-in-a-shell-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>

		<media:content url="http://nixshell.files.wordpress.com/2011/07/space.gif" medium="image">
			<media:title type="html">Space Game</media:title>
		</media:content>
	</item>
		<item>
		<title>Shell Scripting page on Facebook</title>
		<link>http://nixshell.wordpress.com/2011/07/11/shell-scripting-page-on-facebook/</link>
		<comments>http://nixshell.wordpress.com/2011/07/11/shell-scripting-page-on-facebook/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 17:09:36 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[init]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pipes]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=187</guid>
		<description><![CDATA[My Shell Scripting book, due out on August 12th by Wrox, now has a page on Facebook: http://www.facebook.com/pages/Shell-Scripting/175263275869249. Feel free to &#8220;Like&#8221; it, and get the latest updates on the project. I have the final pages to proofread this week, ready to go to the printers. It&#8217;s looking like 576 pages, a little bit over [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=187&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_189" class="wp-caption alignright" style="width: 190px"><a href="http://nixshell.files.wordpress.com/2011/07/ss.jpg"><img src="http://nixshell.files.wordpress.com/2011/07/ss.jpg?w=450" alt="Shell Scripting" title="Shell Scripting"   class="size-full wp-image-189" /></a><p class="wp-caption-text">Shell Scripting</p></div>My Shell Scripting book, due out on August 12th by Wrox, now has a page on Facebook: <a href="http://www.facebook.com/pages/Shell-Scripting/175263275869249">http://www.facebook.com/pages/Shell-Scripting/175263275869249</a>. Feel free to &#8220;Like&#8221; it, and get the latest updates on the project.</p>
<p>I have the final pages to proofread this week, ready to go to the printers. It&#8217;s looking like 576 pages, a little bit over the target of 504 pages, but close enough.</p>
<p>I will update the Table of Contents at <a href="http://sgpit.com/book/">http://sgpit.com/book/</a> once the page count is finalised.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/187/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=187&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2011/07/11/shell-scripting-page-on-facebook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>

		<media:content url="http://nixshell.files.wordpress.com/2011/07/ss.jpg" medium="image">
			<media:title type="html">Shell Scripting</media:title>
		</media:content>
	</item>
		<item>
		<title>Fork Bomb!</title>
		<link>http://nixshell.wordpress.com/2011/06/03/fork-bomb/</link>
		<comments>http://nixshell.wordpress.com/2011/06/03/fork-bomb/#comments</comments>
		<pubDate>Fri, 03 Jun 2011 00:18:21 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=185</guid>
		<description><![CDATA[A few days ago I had to deal with my first ever real-life fork-bombed server. By logging in to the console, I was somehow able to get a shell (one process). Having got that shell, even though I was root, it was difficult to be able to spawn other processes. It turned out that this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=185&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A few days ago I had to deal with my first ever real-life fork-bombed server.</p>
<p>By logging in to the console, I was somehow able to get a shell (one process). Having got that shell, even though I was root, it was difficult to be able to spawn other processes. It turned out that this was because we had restricted the CPU count on the kernel command line (maxcpus=2) so that a dual processor, 16-core machine had only one eighth of its processing power available. The dynamic change to the nproc value does not take this into account, so this unprivileged user was able to fork-bomb the entire machine.</p>
<p>The first thing you might want to do in this situation is to run ps -eaf. That&#8217;s another process, and even as root, you don&#8217;t get to do it. Being Linux, you can see how many processes exist on the system by listing /proc:<br />
<code>cd /proc<br />
echo *<br />
</code><br />
Neither of these commands spawn a new shell, they are both shell builtin commands, so they will work. In this case, with over 69,000 processes, I killed the output before I got too bored. Since there are usually around 200 processes running, that was enough to tell me that something was wrong.</p>
<p>After many attempts, a ps command did work, and confirmed that a certain shell script was being run a lot of times. I couldn&#8217;t cat that file, and didn&#8217;t even have its full name (ps truncates output to match the terminal&#8217;s width). I had the PID, so /proc/$PID/fd gave the filename.</p>
<p>It&#8217;s not possible to cat the script to see what it&#8217;s doing, so more builtin commands are required.<br />
<code>$ while read f<br />
&gt; do<br />
&gt; echo $f<br />
&gt; done &lt; /path/to/script.sh</code><br />
This uses all builtin commands, and tells you what the script is. From there, you may have some insight into what it is doing, and how to stop it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/185/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=185&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2011/06/03/fork-bomb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>Shell Scripting Recipes &#8211; Expert Ingredients for Linux, Bash and more</title>
		<link>http://nixshell.wordpress.com/2011/05/29/shell-scripting-recipes-expert-ingredients-for-linux-bash-and-more/</link>
		<comments>http://nixshell.wordpress.com/2011/05/29/shell-scripting-recipes-expert-ingredients-for-linux-bash-and-more/#comments</comments>
		<pubDate>Sun, 29 May 2011 00:36:51 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=178</guid>
		<description><![CDATA[Another update on the upcoming Shell Scripting Recipes book. The writing is complete, the editing formatting and reviewing is now almost totally complete. In the meantime, Amazon&#8217;s UK discount has dropped to £4.80; Amazon.com is still offering a whopping $19.76 (40%) off the pre-order price. The trend seems to be that the prices are going [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=178&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Another update on the upcoming Shell Scripting Recipes book. The writing is complete, the editing formatting and reviewing is now almost totally complete. In the meantime, Amazon&#8217;s UK discount has dropped to £4.80; Amazon.com is still offering a whopping $19.76 (40%) off the pre-order price. The trend seems to be that the prices are going back upwards towards the list price as the launch date (12th August 2011) comes closer so you may save more by ordering a copy now.</p>
<p>The full chapter list is at <a href="http://sgpit.com/book" title="http://sgpit.com/book" target="_blank">http://sgpit.com/book/</a> along with links to other pages with more details about the book.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/178/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=178&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2011/05/29/shell-scripting-recipes-expert-ingredients-for-linux-bash-and-more/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>Update on Shell Scripting Recipes book</title>
		<link>http://nixshell.wordpress.com/2011/04/23/update-on-shell-scripting-recipes-book/</link>
		<comments>http://nixshell.wordpress.com/2011/04/23/update-on-shell-scripting-recipes-book/#comments</comments>
		<pubDate>Sat, 23 Apr 2011 01:06:52 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[init]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MLP]]></category>
		<category><![CDATA[pipes]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=167</guid>
		<description><![CDATA[Wow, it's been nearly two months since I last made a post about the upcoming book on shell scripting. I'm really sorry, I had intended to give much more real-time updates here. The book focusses on GNU/Linux and the Bash shell in particular, but it does cover the other environments too - Solaris, Bourne Shell, as well as mentions for ksh, zsh, *BSD and the rest of the Unix family. <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=167&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Wow, it&#8217;s been nearly two months since I last made a post about the upcoming book on shell scripting. I&#8217;m really sorry, I had intended to give much more real-time updates here. The book focusses on GNU/Linux and the Bash shell in particular, but it does cover the other environments too &#8211; Solaris, Bourne Shell, as well as mentions for ksh, zsh, *BSD and the rest of the Unix family. </p>
<p>In terms of page count, it is currently 89% finished. There is still the proof-reading to be done, and whatever delivery details the publishers need to deal with, so the availability date of some time in August is still on schedule. I notice that <a href="http://amzn.com/1118024486">http://amzn.com/1118024486</a> is already offering a massive discount on the cover price; I have no idea what that is about, I&#8217;m trying not to take offence &#8211;  they can&#8217;t have dismissed the book already as I have not quite finished writing it yet! So hopefully you can get a bargain while it&#8217;s cheap.</p>
<p>The subject matter has the potential to be quite boring if presented as a list of tedious system administration tasks, so I have tried to make it light and fun whenever I can; it&#8217;s still with Legal at the moment, but I hope to have a Space Invaders clone written entirely in the shell published in the book. People don&#8217;t tend to see the Shell as being capable of doing anything interactive at all, so it is nice to write a playable interactive game in the shell. The main problem in terms of playability is in working out how much to slow it down, and at what stage! Of course, being a shell script, you can tweak the starting value, the level at which it speeds up, and anything else about the gameplay. If the game doesn&#8217;t make it in to the book, I&#8217;ll post it here anyway, and will welcome your contributions on gameplay.</p>
<p>Other than games, I&#8217;ve got recipes for init scripts, conditional execution, translating scripts into other (human) languages, even writing CGI scripts in the shell. There is coverage of arrays, functions, libraries, process control, wildcards and filename expansion, pipes and pipelines, exec and redirection of input and output; this book aims to cover pretty much all that you need to know about shell scripting without being a tedious list of what the bash shell can do.</p>
<p>There is a status page at <a href="http://sgpit.com/book">http://sgpit.com/book</a> which also has order information; you can pre-order your copy from there.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/167/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=167&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2011/04/23/update-on-shell-scripting-recipes-book/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>Shell Scripting Recipes</title>
		<link>http://nixshell.wordpress.com/2011/03/03/shell-scripting-recipes/</link>
		<comments>http://nixshell.wordpress.com/2011/03/03/shell-scripting-recipes/#comments</comments>
		<pubDate>Thu, 03 Mar 2011 01:13:32 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=163</guid>
		<description><![CDATA[This is just a heads-up that my Shell Scripting Recipes book is due out in August 2011.

I hope to publish more details here as things progress; for now, it is well on the way, but it is not too late for readers to contact me (steve@steve-parker.org) if there is anything that you see as vital for a Shell Scripting Recipes book which was maybe missing from some other book you saw.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=163&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is just a heads-up that my Shell Scripting Recipes book is due out in August 2011.</p>
<p>I hope to publish more details here as things progress; for now, it is well on the way, but it is not too late for readers to contact me (steve@steve-parker.org) if there is anything that you see as vital for a Shell Scripting Recipes book which was maybe missing from some other book you saw.</p>
<p><a href="http://amzn.com/1118024486">http://amzn.com/1118024486</a><br />
<img src="http://ecx.images-amazon.com/images/I/51LgcTSaucL._SL500_AA300_.jpg" alt="Shell Scripting Recipes by Steve Parker" /></p>
<p>Part I covers Language and Usage; all of the concepts of the Shell and how it works.<br />
Part II is Recipes using System Tools. This covers the commands that are necessary for shell scripting, and includes quite a few surprising ways to use them.<br />
Part III is Recipes using Shell Features. This is similar to Part II but it gives concrete uses for the theory presented in Part I.<br />
Part IV is Recipes for Systems Administration. This provides (and explains) various recipes for real-world systems administration tasks of and  beyond the ordinary.  </p>
<p>I do intend to keep you appraised of progress; you can also follow my personal blog at <a href="http://steve-parker.org/urandom/">http://steve-parker.org/urandom/</a> for more detailed updates. The RSS feed for that blog is <a href="http://steve-parker.org/urandom/rss.php">http://steve-parker.org/urandom/rss.php</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/163/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=163&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2011/03/03/shell-scripting-recipes/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>

		<media:content url="http://ecx.images-amazon.com/images/I/51LgcTSaucL._SL500_AA300_.jpg" medium="image">
			<media:title type="html">Shell Scripting Recipes by Steve Parker</media:title>
		</media:content>
	</item>
		<item>
		<title>lsof, fuser, nohup, disown, bg, fg, and jobs</title>
		<link>http://nixshell.wordpress.com/2011/02/04/lsof-fuser-nohup-disown-bg-fg-and-jobs/</link>
		<comments>http://nixshell.wordpress.com/2011/02/04/lsof-fuser-nohup-disown-bg-fg-and-jobs/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 01:55:47 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=161</guid>
		<description><![CDATA[lsof is great, but almost only GNU/Linux; fuser is good, but restricted in how much it actually tells you - you have to go digging into PIDs to see what has to be KILLed or otherwise dealt with.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=161&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Bit of a cheeky one here &#8211; what does anybody want to know about these topics?</p>
<p>There is a book in the pipeline, and I have lots to say about all these things, but am very interested to hear what you think is easy / hard / intuitive / arcane / stupid about these commands and the whole job control side of Unix/Linux and the different shells.</p>
<p>lsof is great, but almost only GNU/Linux; fuser is good, but restricted in how much it actually tells you &#8211; you have to go digging into PIDs to see what has to be KILLed or otherwise dealt with.</p>
<p>What, oh faithful few who may still be following this terribly intermittent blog, do you want to see on the subject of processes and job control in the *nix shell?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/161/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=161&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2011/02/04/lsof-fuser-nohup-disown-bg-fg-and-jobs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>2010 in review</title>
		<link>http://nixshell.wordpress.com/2011/01/02/2010-in-review/</link>
		<comments>http://nixshell.wordpress.com/2011/01/02/2010-in-review/#comments</comments>
		<pubDate>Sun, 02 Jan 2011 12:12:42 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=157</guid>
		<description><![CDATA[The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here&#8217;s a high level summary of its overall blog health: The Blog-Health-o-Meter&#8482; reads Fresher than ever. Crunchy numbers A helper monkey made this abstract painting, inspired by your stats. About 3 million people visit the Taj Mahal every year. This [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=157&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[
<p>The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here&#8217;s a high level summary of its overall blog health:</p>
<p align="center"><img style="border:1px solid #ddd;background:#f5f5f5;padding:20px;" src="http://s0.wp.com/i/annual-recap/meter-healthy3.gif" width="250" height="183" alt="Healthy blog!"></p>
<p align="center">The <em>Blog-Health-o-Meter&trade;</em> reads Fresher than ever.</p>
<h2>Crunchy numbers</h2>
<div style="width:288px;float:right;border:1px solid #ddd;background:#fff;margin:0 0 1em 1em;padding:6px;">
<p>				<img src="http://s0.wp.com/i/annual-recap/abstract-stats-6.png" alt="Featured image" /><br />
				<br /><em>A helper monkey made this abstract painting, inspired by your stats.</em></p></div>
<p>About 3 million people visit the Taj Mahal every year.  This blog was viewed about <strong>26,000</strong> times in 2010.  If it were the Taj Mahal, it would take about 3 days for that many people to see it.</p>
<p><p>The busiest day of the year was November 9th with <strong>142</strong> views. The most popular post that day was <a style="color:#08c;" href="http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/">Simple Maths in the Unix Shell</a>.</p>
<p></p>
<h2>Where did they come from?</h2>
<p>The top referring sites in 2010 were <strong>steve-parker.org</strong>, <strong>google.com</strong>, <strong>google.co.in</strong>, <strong>ubuntuforums.org</strong>, and <strong>rackerhacker.com</strong>.</p>
<p>Some visitors came searching, mostly for <strong>bash maths</strong>, <strong>suid bit</strong>, <strong>shell script timestamp</strong>, <strong>awk one liners</strong>, and <strong>bash field separator</strong>.</p>
<div style="clear:both;"></div>
<h2>Attractions in 2010</h2>
<p>These are the posts and pages that got the most views in 2010.</p>
<div style="clear:left;float:left;font-size:24pt;line-height:1em;margin:-5px 10px 20px 0;">1</div>
<p>					<a style="margin-right:10px;" href="http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/">Simple Maths in the Unix Shell</a> <span style="color:#999;font-size:8pt;">January 2007</span><br />12 comments											</p>
<div style="clear:left;float:left;font-size:24pt;line-height:1em;margin:-5px 10px 20px 0;">2</div>
<p>					<a style="margin-right:10px;" href="http://nixshell.wordpress.com/2007/03/11/timestamps-for-log-files/">Timestamps for Log Files</a> <span style="color:#999;font-size:8pt;">March 2007</span><br />4 comments											</p>
<div style="clear:left;float:left;font-size:24pt;line-height:1em;margin:-5px 10px 20px 0;">3</div>
<p>					<a style="margin-right:10px;" href="http://nixshell.wordpress.com/2007/04/21/suid-shell-scripts-setting-the-sticky-bit/">suid shell scripts &#8211; setting &#8220;the SUID bit&#8221;</a> <span style="color:#999;font-size:8pt;">April 2007</span><br />5 comments											</p>
<div style="clear:left;float:left;font-size:24pt;line-height:1em;margin:-5px 10px 20px 0;">4</div>
<p>					<a style="margin-right:10px;" href="http://nixshell.wordpress.com/2007/09/26/ifs-internal-field-separator/">IFS &#8211; Internal Field Separator</a> <span style="color:#999;font-size:8pt;">September 2007</span><br />10 comments											</p>
<div style="clear:left;float:left;font-size:24pt;line-height:1em;margin:-5px 10px 20px 0;">5</div>
<p>					<a style="margin-right:10px;" href="http://nixshell.wordpress.com/2007/03/26/calculating-averages/">Calculating Averages</a> <span style="color:#999;font-size:8pt;">March 2007</span><br />7 comments											</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/157/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=157&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2011/01/02/2010-in-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>

		<media:content url="http://s0.wp.com/i/annual-recap/meter-healthy3.gif" medium="image">
			<media:title type="html">Healthy blog!</media:title>
		</media:content>

		<media:content url="http://s0.wp.com/i/annual-recap/abstract-stats-6.png" medium="image">
			<media:title type="html">Featured image</media:title>
		</media:content>
	</item>
		<item>
		<title>inodes &#8211; ctime, mtime, atime</title>
		<link>http://nixshell.wordpress.com/2010/10/07/inodes-ctime-mtime-atime/</link>
		<comments>http://nixshell.wordpress.com/2010/10/07/inodes-ctime-mtime-atime/#comments</comments>
		<pubDate>Thu, 07 Oct 2010 23:04:04 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=152</guid>
		<description><![CDATA[http://www.unix.com/tips-tutorials/20526-mtime-ctime-atime.html has a really good explanation of the different timestamps in a Unix/Linux inode. GNU/Linux has a useful utility called &#8220;stat&#8221; which displays most of the inode contents: $ stat .bashrc File: `.bashrc' Size: 3219 Blocks: 8 IO Block: 4096 regular file Device: fe00h/65024d Inode: 33 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 1000/ steve) Gid: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=152&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.unix.com/tips-tutorials/20526-mtime-ctime-atime.html">http://www.unix.com/tips-tutorials/20526-mtime-ctime-atime.html</a> has a really good explanation of the different timestamps in a Unix/Linux inode. GNU/Linux has a useful utility called &#8220;stat&#8221; which displays most of the inode contents:<br />
<code>$ stat .bashrc<br />
  File: `.bashrc'<br />
  Size: 3219      	Blocks: 8          IO Block: 4096   regular file<br />
Device: fe00h/65024d	Inode: 33          Links: 1<br />
Access: (0644/-rw-r--r--)  Uid: ( 1000/   steve)   Gid: ( 1000/   steve)<br />
Access: 2010-10-07 01:11:21.000000000 +0100<br />
Modify: 2010-08-19 21:22:20.000000000 +0100<br />
Change: 2010-08-19 21:22:21.000000000 +0100<br />
$ </code><br />
As Perderabo explains in the above-linked post:</p>
<blockquote><p>
Unix keeps 3 timestamps for each file: mtime, ctime, and atime. Most people seem to understand atime (access time), it is when the file was last read. There does seem to be some confusion between mtime and ctime though. ctime is the inode change time while mtime is the file modification time. &#8220;Change&#8221; and &#8220;modification&#8221; are pretty much synonymous. There is no clue to be had by pondering those words. Instead you need to focus on what is being changed. mtime changes when you write to the file. It is the age of the data in the file. Whenever mtime changes, so does ctime. But ctime changes a few extra times. For example, it will change if you change the owner or the permissions on the file.</p>
<p>Let&#8217;s look at a concrete example. We run a package called Samba that lets PC&#8217;s access files. To change the Samba configuration, I just edit a file called smb.conf. (This changes mtime and ctime.) I don&#8217;t need to take any other action to tell Samba that I changed that file. Every now and then Samba looks at the mtime on the file. If the mtime has changed, Samba rereads the file. Later that night our backup system runs. It uses ctime, which also changed so it backs up the file. But let&#8217;s say that a couple of days later I notice that the permissions on smb.conf are 666. That&#8217;s not good..anyone can edit the file. So I do a &#8220;chmod 644 smb.conf&#8221;. This changes only ctime. Samba will not reread the file. But later that night, our backup program notices that ctime has changes, so it backs up the file. That way, if we lose the system and need to reload our backups, we get the new improved permission setting.</p>
<p>Here is a second example. Let&#8217;s say that you have a data file called employees.txt which is a list of employees. And you have a program to print it out. The program not only prints the data, but it obtains the mtime and prints that too. Now someone has requested an employee list from the end of the year 2000 and you found a backup tape that has that file. Many restore programs will restore the mtime as well. When you run that program it will print an mtime from the end of the year 2000. But the ctime is today. So again, our backup program will see the file as needing to be backed up.</p>
<p>Suppose your restore program did not restore the mtime. You don&#8217;t want your program to print today&#8217;s date. Well no problem. mtime is under your control. You can set it to what ever you want. So just do:<br />
$ touch -t 200012311800 employees.txt<br />
This will set mtime back to the date you want and it sets ctime to now. You have complete control over mtime, but the system stays in control of ctime. So mtime is a little bit like the date on a letter while ctime is like the postmark on the envelope.</p></blockquote>
<p>This is a really clear, thorough explanation of ctime and mtime. Unfortunately, it is not possible to find the original creation time of a file, though that is somewhat meaningless as things are copied, moved, linked, changed; what is the creation time of a file which was created, removed, then created afresh, for example?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/152/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=152&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2010/10/07/inodes-ctime-mtime-atime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>Interview with Steve Bourne</title>
		<link>http://nixshell.wordpress.com/2010/08/26/145/</link>
		<comments>http://nixshell.wordpress.com/2010/08/26/145/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 23:45:39 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=145</guid>
		<description><![CDATA[ARNnet have an Interview with Steve Bourne I believe you can write shell scripts that will run either in the Bourne shell or Bash. It may have some additional features that aren’t in the Bourne shell. I believe Bash was intended as a strictly compatible open source version of the Bourne shell. Honestly I haven’t [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=145&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>ARNnet have an <a href="http://www.arnnet.com.au/article/279011/a-z_programming_languages_bourne_shell_sh/">Interview with Steve Bourne</a></p>
<blockquote><p>    I believe you can write shell scripts that will run either in the Bourne shell or Bash. It may have some additional features that aren’t in the Bourne shell. I believe Bash was intended as a strictly compatible open source version of the Bourne shell. Honestly I haven’t looked at it in any detail so I could be wrong. I have used Bash myself because I run a Linux/Gnu system at home and it appears to do what I would expect.</p></blockquote>
<p>I have nearly finished reading <a href="http://www.codersatwork.com/">Coders At Work</a> &#8211; Steve Bourne could have been an interesting interviewee for that book.</p>
<p> When I first posted this link at <a href="http://steve-parker.org/urandom/comment.php?art=879">urandom</a>, I was not aware that I myself was quoted, at the top of page 5 of the 7-page interview:</p>
<blockquote><p> Unix Specialist Steve Parker has posted <a href="http://steve-parker.org/sh/sh.shtml">&#8216;Steve&#8217;s Bourne / Bash scripting tutorial&#8217;</a> in which he writes: &#8220;Shell script programming has a bit of a bad press amongst some Unix systems administrators. This is normally because of one of two things: a) The speed at which an interpreted program will run as compared to a C program, or even an interpreted Perl program; b) Since it is easy to write a simple batch-job type shell script, there are a lot of poor quality shell scripts around.&#8221; Do you agree?</p>
<p>    It would be hard to disagree because he probably knows more about it than I do. The truth of the matter is you can write bad code in any language, or most languages anyway, and so the shell is no exception to that. Just as you can write obfuscated C you can write obfuscated shell. It may be that it is easier to write obfuscated shell than it is to write obfuscated C. I don’t know. But that’s the first point.</p>
<p>    The second point is that the shell is a string processing language and the string processing is fairly simple. So there is no fundamental reason why it shouldn’t run fairly efficiently for those tasks. I am not familiar with the performance of Bash and how that is implemented. Perhaps some of the people that he is talking about are running Bash versus the shell but again I don’t have any performance comparisons for them. But that is where I would go and look. I know when I wrote the original implementation of the shell I spent a lot of time making sure that it was efficient. And in particular with respect to the string processing but also just the reading of the command file. In the original implementation that I wrote, the command file was pre-loaded and pre-digested so when you executed it you didn’t have to do any processing except the string substitutions and any of the other semantics that would change values. So that was about as efficient as you could get in an interpretive language without generating code.</p></blockquote>
<p>I think that the points were presented to Steve Bourne in reverse order; his answer to the first point seems to relate to &#8220;b&#8221; (quality of scripts), and his longer answer to the second point seems to relate to &#8220;a&#8221; (performance).</p>
<p>Regarding performance, as he says, the real cost is of the Unix exec() call, which makes &#8220;cat /etc/hosts | grep localhost&#8221; half as fast as &#8220;grep localhost /etc/hosts&#8221;. There is nothing that the shell itself can do about that.</p>
<p>Regarding quality, deliberately obfusacated C is an institution; my point was merely that it is easy to write a bad shell script simply by not knowing how to write a better shell script. As this quote was from the introduction to a shell scripting tutorial, it should hopefully be clear from the context that the tutorial aims to enable the reader to write better shell scripts.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/145/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=145&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2010/08/26/145/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>Solaris 10 SMF Manifests</title>
		<link>http://nixshell.wordpress.com/2010/07/17/solaris-10-smf-manifests/</link>
		<comments>http://nixshell.wordpress.com/2010/07/17/solaris-10-smf-manifests/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 23:56:07 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=142</guid>
		<description><![CDATA[I have recently written a web service which creates Solaris 10 SMF manifests based on the information you give it. It creates a ZIP file with the XML Manifest file, and the startup/shutdown script, based on what you tell it. There is much more that SMF can do &#8211; create entire new runlevels, and so [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=142&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have recently written a web service which creates <a href="http://sgpit.com/smf/">Solaris 10 SMF manifests</a> based on the information you give it.</p>
<p>It creates a ZIP file with the XML Manifest file, and the startup/shutdown script, based on what you tell it.</p>
<p>There is much more that SMF can do &#8211; create entire new runlevels, and so on &#8211; but this does the basic single-instance startup and shutdown stuff that /etc/init.d scripts did.</p>
<p>Feel free to go and check it out at <a href="http://sgpit.com/smf/">sgpit.com/smf/</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/142/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=142&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2010/07/17/solaris-10-smf-manifests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>Useful GNU/Linux Commands</title>
		<link>http://nixshell.wordpress.com/2010/06/23/useful-gnulinux-commands/</link>
		<comments>http://nixshell.wordpress.com/2010/06/23/useful-gnulinux-commands/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 01:08:45 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=137</guid>
		<description><![CDATA[Pádraig Brady has some useful, if somewhat basic hints, at http://www.pixelbeat.org/cmdline.html. He has updated them to include more powerful commands at http://www.pixelbeat.org/docs/linux_commands.html. Here are a few of my favourites (I have taken the liberty of slightly altering some of the code and/or descriptions): From the original: Search recursively for &#8220;expr&#8221; in all *.c and *.h [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=137&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Pádraig Brady has some useful, if somewhat basic hints, at <a href="http://www.pixelbeat.org/cmdline.html">http://www.pixelbeat.org/cmdline.html</a>. He has updated them to include more powerful commands at <a href="http://www.pixelbeat.org/docs/linux_commands.html">http://www.pixelbeat.org/docs/linux_commands.html</a>.</p>
<p>Here are a few of my favourites (I have taken the liberty of slightly altering some of the code and/or descriptions):<br />
<b>From the original:</b><br />
Search recursively for &#8220;expr&#8221; in all *.c and *.h files:<br />
<code>find -name '*.[ch]' | xargs grep -E 'expr'</code></p>
<p>Concatenate lines with training backslash:<br />
<code>sed ':a; /\\$/N; s/\\\n//; ta'</code></p>
<p>Delete line 42 from .known_hosts:<br />
<code>sed -i 42d ~/.ssh/known_hosts</code></p>
<p><b>From the new post:</b><br />
Echo the path one item per line (assumes GNU tr):<br />
<code>echo $PATH | tr : '\n'</code></p>
<p>Top for Network:<br />
<code>iftop</code><br />
Top for Input/Output (I/O):<br />
<code>iotop</code></p>
<p>Get SSL website Certificate:<br />
<code>openssl s_client -connect www.google.com:443 &lt; /dev/null</code></p>
<p>List processes with Port 80 open:<br />
<code>lsof -i tcp:80</code></p>
<p>Edit a remote file directly in vim:<br />
<code>vim scp://user@remote//path/to/file</code></p>
<p>Add 20ms latency to loopback device (for testing):<br />
<code>tc qdisc add dev lo root handle 1:0 netem delay 20msec</code><br />
Remove the latency:<br />
<code>tc qdisc del dev lo root</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/137/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=137&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2010/06/23/useful-gnulinux-commands/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>Ten Good Unix Habits</title>
		<link>http://nixshell.wordpress.com/2010/06/22/ten-good-unix-habits/</link>
		<comments>http://nixshell.wordpress.com/2010/06/22/ten-good-unix-habits/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 00:45:46 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MLP]]></category>
		<category><![CDATA[pipes]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=134</guid>
		<description><![CDATA[IBM&#8217;s DeveloperWorks has 10 Good Unix Habits, which apply to GNU/Linux at least as much as to Unix. I would expect that most experienced admins can second-guess the content to 5-7 of these 10 points, just from the title (for example, item 1 is a reference to &#8220;mkdir -p&#8221;, plus another related syntax available to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=134&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>IBM&#8217;s DeveloperWorks has <a href="http://www.ibm.com/developerworks/aix/library/au-badunixhabits.html?ca=lnxw01GoodUnixHabits">10 Good Unix Habits</a>, which apply to GNU/Linux at least as much as to Unix.</p>
<p>I would expect that most experienced admins can second-guess the content to 5-7 of these 10 points, just from the title (for example, item 1 is a reference to &#8220;mkdir -p&#8221;, plus another related syntax available to Bash users). I would be surprised if you knew all ten:</p>
<p>   1. Make directory trees in a single swipe.<br />
   2. Change the path; do not move the archive.<br />
   3. Combine your commands with control operators.<br />
   4. Quote variables with caution.<br />
   5. Use escape sequences to manage long input.<br />
   6. Group your commands together in a list.<br />
   7. Use xargs outside of find .<br />
   8. Know when grep should do the counting &#8212; and when it should step aside.<br />
   9. Match certain fields in output, not just lines.<br />
  10. Stop piping cats.</p>
<p>How many did you get?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/134/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=134&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2010/06/22/ten-good-unix-habits/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>Unix / Linux Training Courses in the UK</title>
		<link>http://nixshell.wordpress.com/2010/05/11/unix-linux-training-courses-in-the-uk/</link>
		<comments>http://nixshell.wordpress.com/2010/05/11/unix-linux-training-courses-in-the-uk/#comments</comments>
		<pubDate>Tue, 11 May 2010 22:38:54 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[unix]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[uk]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=126</guid>
		<description><![CDATA[.... The kind of training session I would envisage us providing, would involve a fairly small class size (less than 6 people), allowing us to focus on your current issues, and tailor the course around the needs, interests and skills of the attendees.....<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=126&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After a few customers requesting it, my consultancy firm, <a href="http://sgpit.com/">SGP IT</a>, is planning to run some technical training courses this Summer; in the Manchester area initially, though any location is possible.</p>
<p>Now would be a very good time to get in touch (<a href="mailto:training@sgpit.com">training@sgpit.com</a>) as things are at a very early stage and very fluid &#8211; if you can bring a few people along, we can even run a bespoke course for you, and tailor everything to your need.</p>
<p>Depending on subject, duration, location and so on, it should be possible to run the first few courses for as little as £250 &#8211; £300 per person per day &#8211; much less than the £400 &#8211; £500 or so you&#8217;d pay for a corporate course where you all get is a trainer who has no experience of the actual situation you face at work, and who delivers powerpoint slides to you, then doles out the free mousepads and t-shirts at the end of the course.</p>
<p>None of us have been overly impressed by many of the available training courses &#8211; we are hoping to redefine how personal IT training can be delivered. Here&#8217;s how:</p>
<p>The kind of training session I would envisage us providing, would involve a fairly small class size (certainly fewer than 6 people), allowing us to focus on your current issues, and tailor the course around the needs, interests and skills of the attendees. The courses are likely to be between 2 and 5 days, most being 2-3 day courses.</p>
<p>Of course, there will be no corners cut &#8211; we will insist on great location and facilities, free internet access, PCs for all candidates (preinstalled with Linux, Solaris, *BSD, you name it &#8211; contact us before the course and we&#8217;ll build the PC to suit you), tons of good quality course notes, including certificates and the obligatory full VAT receipts, of course. I&#8217;m sure that we can find a few freebies to throw in, too!</p>
<p>If you have specific queries or concerns that you would like to be addressed in the course, let us know up-front, and we can find a way to work it in to the course.</p>
<p>If any of this sounds vaguely interesting, please do get in touch (<a href="mailto:training@sgpit.com">training@sgpit.com</a>) and we can mold things around your requirements.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/126/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=126&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2010/05/11/unix-linux-training-courses-in-the-uk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>Use of pipes, and other nifty tricks</title>
		<link>http://nixshell.wordpress.com/2009/12/18/use-of-pipes-and-other-nifty-tricks/</link>
		<comments>http://nixshell.wordpress.com/2009/12/18/use-of-pipes-and-other-nifty-tricks/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 00:05:09 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[init]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MLP]]></category>
		<category><![CDATA[pipes]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=124</guid>
		<description><![CDATA[These hints go on and on; hardly any of them are the generic stuff you often see on Ubuntu forums, stumbleupon, and so on.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=124&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tuxradar.com/content/command-line-tricks-smart-geeks">http://www.tuxradar.com/content/command-line-tricks-smart-geeks</a> has some useful tricks. A lot of it is presented as being bash-specific, but isn&#8217;t. Also, a lot seems Linux-specific, but isn&#8217;t. Lots of useful info for all Unix/Linux admins here. These hints go on and on; hardly any of them are the generic stuff you often see on Ubuntu forums, stumbleupon, and so on.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/124/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=124&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2009/12/18/use-of-pipes-and-other-nifty-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>Flushing Cache to Disk under Linux</title>
		<link>http://nixshell.wordpress.com/2009/11/04/flushing-cache-to-disk-under-linux/</link>
		<comments>http://nixshell.wordpress.com/2009/11/04/flushing-cache-to-disk-under-linux/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 01:06:03 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=121</guid>
		<description><![CDATA[There are lots of well-written articles, such as this [westnet.com] and especially this [kerneltrap] on Page Cacheing and pdflush, but RackerHacker (although the title says &#8220;reads&#8221;, it really seems to address lots of small writes) summarises it very well: vm.dirty_ratio – The highest % of your memory that can be used to hold dirty data. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=121&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There are lots of well-written articles, such as <a href="http://www.westnet.com/~gsmith/content/linux-pdflush.htm">this</a> [westnet.com] and especially <a href="http://kerneltrap.org/node/3000">this</a> [kerneltrap] on Page Cacheing and pdflush, but <a href="http://rackerhacker.com/2008/08/07/reduce-disk-io-for-small-reads-using-memory/">RackerHacker</a> (although the title says &#8220;reads&#8221;, it really seems to address lots of small writes) summarises it very well:</p>
<blockquote><p><strong>vm.dirty_ratio</strong> – The highest % of your memory that can be used to hold dirty data. If you set this to a low value, the kernel will flush small writes to the disk more often. Higher values allow the small writes to stack up in memory. They’ll go to the disk in bigger chunks.</p>
<p><strong>vm.dirty_background_ratio</strong> – The lowest % of your memory where pdflush is told to stop when it is writing dirty data. You’ll want to keep this set as low as possible.</p></blockquote>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/121/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=121&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2009/11/04/flushing-cache-to-disk-under-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>find, locate, whereis, which, type</title>
		<link>http://nixshell.wordpress.com/2009/09/16/find-locate-whereis-which-type/</link>
		<comments>http://nixshell.wordpress.com/2009/09/16/find-locate-whereis-which-type/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 00:13:15 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=117</guid>
		<description><![CDATA[I suspect that most Linux admins know 3 or 4 of these five commands, and regularly use 2 or 3 of them. linuxhaxor has a useful introduction to all five, with the most common uses for each of them. Note that locate requires a regular run of updatedb &#8211; the article says that &#8220;The database [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=117&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I suspect that most Linux admins know 3 or 4 of these five commands, and regularly use 2 or 3 of them.</p>
<p><a href="http://www.linuxhaxor.net/2008/09/25/5-ways-to-search-for-files-using-the-terminal-in-linux/">linuxhaxor</a> has a useful introduction to all five, with the most common uses for each of them.</p>
<p>Note that <code>locate</code> requires a regular run of <code>updatedb</code> &#8211; the article says that &#8220;The database is automatically created and updated daily&#8221; which is true for most distributions, but it depends on your <code>cron</code> setup &#8211; you can update the locate db as frequently as you wish. Another thing to note about <code>locate</code> is that it will not use the (normally <code>root</code>-generated) database to tell you (as a non-privileged user) about files which you would not otherwise know about.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/117/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=117&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2009/09/16/find-locate-whereis-which-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>get the width of the terminal</title>
		<link>http://nixshell.wordpress.com/2009/09/08/get-the-width-of-the-terminal/</link>
		<comments>http://nixshell.wordpress.com/2009/09/08/get-the-width-of-the-terminal/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 15:43:32 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=112</guid>
		<description><![CDATA[A quick and easy way to get the width of your Linux terminal is the command <code>stty size</code><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=112&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A quick and easy way to get the width of your terminal is the command <code>stty size</code>. I have used it with <code>diff</code> like this:</p>
<blockquote><p>diff -y -W `stty size | cut -d&#8221; &#8221; -f2` &#8211;suppress-common-lines oldfile newfile</p></blockquote>
<p>Note: This stty option is not available on Solaris, however, if you have it installed, the /usr/openwin/bin/resize command sets the COLUMNS variable.</p>
<p><strong>update:</strong> This post originally said &#8220;width of your Linux terminal&#8221; but as noted in the comments, this feature of <code>stty</code> is also available in *BSD implementations, even though it is not part of the <code>POSIX</code> standard. So you should expect this to work on GNU and BSD systems (eg, most GNU/Linux distros, most *BSDs, including OSX) but not on all POSIX-compliant systems (eg, Solaris). I would assume that AIX, HPUX, SCO, the other &#8220;traditional&#8221; UNIX systems would also not support this, though I have not (yet) tested any of them. YMMV.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/112/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=112&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2009/09/08/get-the-width-of-the-terminal/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>tty, pts, and all of that&#8230;</title>
		<link>http://nixshell.wordpress.com/2009/07/19/109/</link>
		<comments>http://nixshell.wordpress.com/2009/07/19/109/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 00:03:57 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=109</guid>
		<description><![CDATA[The TTY Demystified tells you everything you need to know (and quite possibly more) about the *nix tty history. (If you do need to know more than this, you are probably already writing your own *nix kernel, or at least libc) Hopefully that should give some insight into the terminfo, and other obscure details of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=109&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.linusakesson.net/programming/tty/index.php">The TTY Demystified</a> tells you everything you need to know (and quite possibly more) about the *nix tty history. (If you do need to know more than this, you are probably already writing your own *nix kernel, or at least libc)</p>
<p>Hopefully that should give some insight into the terminfo, and other obscure details of the *nix kernel and its obsession with piping characters from one place to another.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/109/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=109&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2009/07/19/109/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux Command Directory</title>
		<link>http://nixshell.wordpress.com/2009/05/16/linux-command-directory/</link>
		<comments>http://nixshell.wordpress.com/2009/05/16/linux-command-directory/#comments</comments>
		<pubDate>Sat, 16 May 2009 00:39:13 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MLP]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=107</guid>
		<description><![CDATA[I just found this page on the OReilly website &#8211; a Linux Command Directory Click on any of the 687 commands below to get a description and list of available options. All links in the command summaries point to the online version of the book on Safari Bookshelf. It doesn&#8217;t cover everything (what could?) but [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=107&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I just found this page on the OReilly website &#8211; a <a href="http://oreilly.com/linux/command-directory/">Linux Command Directory</a></p>
<blockquote><p>Click on any of the 687 commands below to get a description and list of available options. All links in the command summaries point to the online version of the book on Safari Bookshelf.</p></blockquote>
<p>It doesn&#8217;t cover everything (what could?) but it could be a useful page to bookmark.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/107/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=107&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2009/05/16/linux-command-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>awk one-liners</title>
		<link>http://nixshell.wordpress.com/2009/04/01/awk-one-liners/</link>
		<comments>http://nixshell.wordpress.com/2009/04/01/awk-one-liners/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 22:05:31 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MLP]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=98</guid>
		<description><![CDATA[I have previously plugged the great list of sed 1-liners at http://sed.sourceforge.net/sed1line.txt. Here is a similar (if shorter) list of handy awk 1-liners: http://www.sap-basis-abap.com/unix/awk-one-liner-tips.htm: Print column1, column5 and column7 of a data file or output of any columns list awk '{print $1, $5, $7}' data_file cat file_name &#124;awk '{print $1 $5 $7}' ls –al &#124;awk [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=98&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have previously plugged the great list of sed 1-liners at <a href="http://sed.sourceforge.net/sed1line.txt">http://sed.sourceforge.net/sed1line.txt</a>.</p>
<p>Here is a similar (if shorter) list of handy awk 1-liners:</p>
<p><a href="http://www.sap-basis-abap.com/unix/awk-one-liner-tips.htm">http://www.sap-basis-abap.com/unix/awk-one-liner-tips.htm</a>:</p>
<p><strong>Print column1, column5 and column7 of a data file or output of any columns list</strong></p>
<p><code>awk '{print $1, $5, $7}' data_file</p>
<p>cat file_name |awk '{print $1 $5 $7}'</p>
<p>ls –al |awk '{print $1, $5, $7}' -- Prints file_permissions,size and date<br />
</code><br />
<strong>List all files names whose file size greater than zero.</strong></p>
<p><code>ls –al |awk '$5 &gt; 0 {print $9}'<br />
</code><br />
<strong>List all files whose file size equal to 512bytes.<br />
</strong><br />
<code>ls –al |awk '$5 == 512 {print $9}'</code></p>
<p><strong>print all lines</strong></p>
<p><code>awk '{print }' file_name</p>
<p>awk '{print 0}' file_name</code><br />
<strong><br />
Number of lines in a file</strong><br />
<code><br />
awk ' END {print NR}' file_name<br />
</code><br />
<strong>Number of columns in each row of a file<br />
</strong><br />
<code>awk '{print NF}' file_name<br />
</code><br />
<strong>Sort the output of file and eliminate duplicate rows<br />
</strong><br />
<code>awk '{print $1, $5, $7}' |sort –u<br />
</code><br />
<strong>List all file names whose file size is greater than 512bytes and owner is &#8220;oracle&#8221;<br />
</strong><br />
<code>ls –al |awk '$3 == "oracle" &amp;&amp; $5 &gt; 512 {print $9}'<br />
</code><br />
<strong>List all file names whose owner could be either &#8220;oracle&#8221; or &#8220;root&#8221;<br />
</strong><br />
<code>ls –al |awk '$3 == "oracle" || $3 == "root" {print $9}'<br />
</code><br />
<strong>list all the files whose owner is not &#8220;oracle<br />
</strong><br />
<code>ls –al |awk '$3 != "oracle" {print $9}'<br />
</code><br />
<strong>List all lines which has at least one or more characters<br />
</strong><br />
<code>awk 'NF &gt; 0 {print }' file_name<br />
</code><br />
<strong>List all lines longer that 50 characters<br />
</strong><br />
<code>awk 'length($0) &gt; 50 {print }' file_name<br />
</code><br />
<strong>List first two columns<br />
</strong><br />
<code>awk '{print $1, $2}' file_name<br />
</code><br />
<strong>Swap first two columns of a file and print<br />
</strong><br />
<code>awk '{temp = $1; $1 = $2; $2 = temp; print }' file_name<br />
</code><br />
<strong>Replace first column as &#8220;ORACLE&#8221; in a data file<br />
</strong><br />
<code>awk '{$1 = "ORACLE"; print }' data_file<br />
</code><br />
<strong>Remove first column values in a data file<br />
</strong><br />
<code>awk '{$1 =""; print }' data_file<br />
</code><br />
<strong>Calculate total size of a directory in Mb<br />
</strong><code><br />
ls –al |awk '{total +=$5};END {print "Total size: " total/1024/1024 " Mb"}'<br />
</code><strong><br />
Calculate total size of a directory including sub directories in Mb<br />
</strong><code><br />
ls –lR |awk '{total +=$5};END {print "Total size: " total/1024/1024 " Mb"}'</code><br />
<strong><br />
Find largest file in a directory including sub directories<br />
</strong><br />
<code>ls –lR |awk '{print $5 "\t" $9}' |sort –n |tail -1 </code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=98&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2009/04/01/awk-one-liners/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>Saving, Escaping, and Restoring positional parameters in a POSIX shell</title>
		<link>http://nixshell.wordpress.com/2009/03/21/saving-escaping-and-restoring-positional-parameters-in-a-posix-shell/</link>
		<comments>http://nixshell.wordpress.com/2009/03/21/saving-escaping-and-restoring-positional-parameters-in-a-posix-shell/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 23:44:35 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=94</guid>
		<description><![CDATA[http://www.seanius.net/blog/2009/03/saving-and-restoring-positional-params/ has a really good post about how &#8220;shift&#8221; loses the original command-line arguments, discusses various seemingly-obvious ways of restoring them, explores why they fail for certain types of input, and provides what seems to be a working solution: one way you could try to store/save them would be to save the original copy of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=94&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.seanius.net/blog/2009/03/saving-and-restoring-positional-params/">http://www.seanius.net/blog/2009/03/saving-and-restoring-positional-params/</a> has a really good post about how &#8220;shift&#8221; loses the original command-line arguments, discusses various seemingly-obvious ways of restoring them, explores why they fail for certain types of input, and provides what seems to be a working solution:</p>
<blockquote><p>one way you could try to store/save them would be to save the original copy of $@ and use eval set &#8212; later on to change it back to the saved variable</p></blockquote>
<p>&#8230; but as it turns out, that doesn&#8217;t work with spaces, or quotes. Excellent, really concise description of the problem(s) and solution(s).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/94/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=94&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2009/03/21/saving-escaping-and-restoring-positional-parameters-in-a-posix-shell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>Using GNU Grep for Fun and Profit!</title>
		<link>http://nixshell.wordpress.com/2009/02/11/using-gnu-grep-for-fun-and-profit/</link>
		<comments>http://nixshell.wordpress.com/2009/02/11/using-gnu-grep-for-fun-and-profit/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 02:03:42 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=91</guid>
		<description><![CDATA[Shell Script: GetCluster &#8211; a shell script I happen to have written today; uses a few features of GNU Grep, whilst being tolerant of non-GNU greps (at the cost of some functionality). This simple shell script is an example of the kind of thing that can easily be done with a few simple commands. As [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=91&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://steve-parker.org/urandom/comment.php?art=693">Shell Script: GetCluster</a> &#8211; a shell script I happen to have written today; uses a few features of GNU Grep, whilst being tolerant of non-GNU greps (at the cost of some functionality).</p>
<p>This simple shell script is an example of the kind of thing that can easily be done with a few simple commands. As it is intended for the Solaris platform, which does not necessarily include GNU&#8217;s grep, some additional complexity is required to see what the platform&#8217;s grep utility is capable of.</p>
<p>This is achieved by:<br />
1) Set the PATH to pick up the GNU tools first: <code>PATH=/usr/sfw/bin:$PATH</code><br />
2) Find grep (ggrep if possible; the existence of ggrep suggests that grep itself is not GNU&#8217;s grep):<br />
<code>type ggrep &gt;/dev/null 2&gt;&amp;1<br />
if [ "$?" -eq "0" ]; then<br />
  GREP=`which ggrep`<br />
else<br />
  GREP=`which grep`<br />
fi<br />
</code></p>
<p>It then finds a file, which could be in one of many places:<br />
<code>CLUSTERTOC=`ls clustertoc .clustertoc /cdrom/cdrom0/Solaris*/Product/.clustertoc /cdrom/Solaris*/Product/.clustertoc /mnt/Solaris*/Product/.clustertoc 2&gt;/dev/null|head -1`</code><br />
What this does, is identify the first succesful match (the rest go to /dev/null). If none is found, the CLUSTERTOC will not be a valid file (note: this gets us the added bonus that it will complain if clustertoc is a device driver, pipe, etc).</p>
<p>It then looks for &#8220;SUNW_CSRMEMBER&#8221; in the clustertoc, using &#8220;<code>grep -n</code>&#8221; to get the line number, then passing that linenumber on to <code>head</code> so as to limit the output to only contain those lines. Any lines below that point would refer to other clusters, and be irrelevant. We want to get the last of the relevant part of the file, so that the <code>tail</code> command below will give us what we need.</p>
<p>GNU Grep has a &#8220;-A n&#8221; and &#8220;-B n&#8221; facility to say &#8220;include n lines After the matching line&#8221; or &#8220;include n lines Before the matching line&#8221;. We use &#8220;-A&#8221; here to get the following lines which describe the pacakge in more detail:<br />
<code>   head -${linenum} $CLUSTERTOC |$GREP -A4 "^CLUSTER="|cut -d"=" -f2-|tail -4</code></p>
<p>See the <a href="http://steve-parker.org/code/sh/getcluster/readme.txt">readme</a> file for specific output &#8211; the Solaris (non-GNU) version has notably less detail than the GNU version. </p>
<p>Hopefully the script (<a href="http://steve-parker.org/code/sh/getcluster/getcluster.sh">http://steve-parker.org/code/sh/getcluster/getcluster.sh</a>) is in other ways sufficiently self-explanatory.</p>
<p>The input file (<a href="http://steve-parker.org/code/sh/getcluster/clustertoc">http://steve-parker.org/code/sh/getcluster/clustertoc</a> is relatively simple, and should explain any other queries.</p>
<p>Still &#8211; this simple script may provoke a few questions; please do play with it and ask away, if anything is unclear. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/91/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=91&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2009/02/11/using-gnu-grep-for-fun-and-profit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>
	</item>
		<item>
		<title>Happy Second Birthday!</title>
		<link>http://nixshell.wordpress.com/2009/01/21/happy-second-birthday/</link>
		<comments>http://nixshell.wordpress.com/2009/01/21/happy-second-birthday/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 01:41:07 +0000</pubDate>
		<dc:creator>unixshell</dc:creator>
				<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://nixshell.wordpress.com/?p=85</guid>
		<description><![CDATA[I have missed the second birthday of this blog; starting with Hello World on 17th January 2007, this blog has seen a small growth, but the comments posted show that people have found it to be useful, which is good. I hope that you continue to find it useful; I really will try to post [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=85&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have missed the second birthday of this blog; starting with <a href="http://nixshell.wordpress.com/2007/01/17/hello-world/">Hello World</a> on 17th January 2007, this blog has seen a small growth, but the comments posted show that people have found it to be useful, which is good.</p>
<div id="attachment_87" class="wp-caption aligncenter" style="width: 310px"><img src="http://nixshell.files.wordpress.com/2009/01/traffic.gif?w=300&#038;h=150" alt="Traffic" title="traffic" width="300" height="150" class="size-medium wp-image-87" /><p class="wp-caption-text">Traffic</p></div>
<div id="attachment_86" class="wp-caption aligncenter" style="width: 310px"><img src="http://nixshell.files.wordpress.com/2009/01/stats.gif?w=300&#038;h=242" alt="Statistics" title="stats" width="300" height="242" class="size-medium wp-image-86" /><p class="wp-caption-text">Statistics</p></div>
<p>I hope that you continue to find it useful; I really will try to post a bit more often in 2009!</p>
<p>Steve</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/nixshell.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/nixshell.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/nixshell.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/nixshell.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/nixshell.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/nixshell.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/nixshell.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/nixshell.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/nixshell.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/nixshell.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/nixshell.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/nixshell.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/nixshell.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/nixshell.wordpress.com/85/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=nixshell.wordpress.com&amp;blog=691157&amp;post=85&amp;subd=nixshell&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://nixshell.wordpress.com/2009/01/21/happy-second-birthday/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8ab417ce7eba8048dd89d99088e7b7e5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">unixshell</media:title>
		</media:content>

		<media:content url="http://nixshell.files.wordpress.com/2009/01/traffic.gif?w=300" medium="image">
			<media:title type="html">traffic</media:title>
		</media:content>

		<media:content url="http://nixshell.files.wordpress.com/2009/01/stats.gif?w=300" medium="image">
			<media:title type="html">stats</media:title>
		</media:content>
	</item>
	</channel>
</rss>
