<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jabbering Giraffe &#187; zsh</title>
	<atom:link href="http://happygiraffe.net/blog/tag/zsh/feed/" rel="self" type="application/rss+xml" />
	<link>http://happygiraffe.net/blog</link>
	<description></description>
	<lastBuildDate>Wed, 19 Oct 2011 10:40:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>My Sysadmin Toolbox</title>
		<link>http://happygiraffe.net/blog/2006/04/17/my-sysadmin-toolbox/</link>
		<comments>http://happygiraffe.net/blog/2006/04/17/my-sysadmin-toolbox/#comments</comments>
		<pubDate>Mon, 17 Apr 2006 10:32:00 +0000</pubDate>
		<dc:creator>Dominic Mitchell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[gdb]]></category>
		<category><![CDATA[lsof]]></category>
		<category><![CDATA[multitail]]></category>
		<category><![CDATA[mutt]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[strace]]></category>
		<category><![CDATA[sudo]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[wiki]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://happygiraffe.net/2006/04/17/my-sysadmin-toolbox/</guid>
		<description><![CDATA[After seeing lots of these at Linux.com recently, I thought I&#8217;d try to come up with my own list. I used to be a sysadmin (I&#8217;m now a programmer), and I&#8217;ve long felt that you really a good set of &#8230; <a href="http://happygiraffe.net/blog/2006/04/17/my-sysadmin-toolbox/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After seeing lots of these at <a href="http://www.linux.com/">Linux.com</a> recently, I thought I&#8217;d try to come up with my own list.  I used to be a sysadmin (I&#8217;m now a programmer), and I&#8217;ve long felt that you really a good set of tools (and to know how to use them) in order to be most productive.</p>
<ul>
<li>
<p><a href="http://www.zsh.org/">zsh</a></p>
<p>I spend the vast majority of my time at a command line.  Zsh ensures I make best use of my time.  If you&#8217;ve used bash, you might think you know what completion is&#8212;press the tab key and it fills out file names for you.  But zsh takes it to a whole new level.  Not only does it complete file names, but also users, hostnames, option flags, environment variables, PIDs and more.  On top of that, it does it in a context-sensitive manner.  So if you type in &#8220;chown &#8221; and press <span class="caps">TAB</span>, it starts completing usernames.  Type in a space and another <span class="caps">TAB</span> and it starts completing file names again.</p>
<p>On top of that, it allows <em>partial</em> completion.  If I type in <code>/u/l/e/r/</code> and press <span class="caps">TAB</span>, It gets expanded to <code>/usr/local/etc/rc.d/</code>.  This is phenomenally useful.</p>
<p>But it&#8217;s not just completion that zsh is good at.  It&#8217;s also good at <em>globbing</em>.  That&#8217;s turning wildcards into filenames.  In addition to the usual forms of globbing, zsh can glob recursively.  So if I want to look for &#8220;foobar&#8221; in all my files (but not directories), I can do:</p>
<pre>
  % grep foobar **/*(.)
</pre>
<p>The &#8220;<code>**/*</code>&#8221; is the recursive glob, and the &#8220;<code>(.)</code>&#8221; limits it to files and not directories.  You can also limit by user, by timestamp and a few other things.</p>
<p>This is just covering the surface of zsh.  Suffice to say that if you make heavy use of the command line, investing some time in learning zsh will make you vastly more productive.</p>
</li>
<li>
<p><a href="http://www.gnu.org/software/screen/">screen</a></p>
<p>This was mentioned on a few of the other lists as well.  <span class="caps">GNU</span> Screen on the face of it doesn&#8217;t do anything.  You just end up with another command line when you first run it.  But the beauty of it is that if you get disconnected, you can just log back in, run <code>screen -d -r</code> and pick up exactly where you left off.  For me, this is ideal, given the flakiness of my home wireless network.  But you might want to use it so you can shut down your PC at night and pick up where you left off in the morning.</p>
<p>On top of that, screen lets you run multiple command lines at once inside it, log the output and cut&#8217;n&#8217;paste between them.  Think of it as a safety harness for your work.</p>
</li>
<li>
<p><a href="http://samba.anu.edu.au/rsync/">rsync</a></p>
<p>Rsync is one of the closer things to magic that&#8217;s around.  It&#8217;s a simple file copying utility.  But the clever bit is that it only copies the things that have changed.  This doesn&#8217;t sound like much until you&#8217;ve edited several files in a collection which is 200Mb and needs to be on another box.  When rsync tells you it&#8217;s finished and only transferred 10Kb instead of 200Mb, you&#8217;ll really come to appreciate it.</p>
<p>If you&#8217;re still using tar/gzip or zip to create an archive to ship to another computer, stop wasting your time and disk space.  Learn to use rsync and your life will be far more pleasant.</p>
</li>
<li>
<p><a href="http://www.openssh.com/">OpenSSH</a></p>
<p>Thankfully, ssh is pretty ubiquitous these days.  It seems to have mostly worked in its mission to eliminate <a href="http://en.wikipedia.org/wiki/Telnet">telnet</a>.  But it has a few tricks that are worth knowing about.</p>
<p>First, the agent.  One of the nice things about ssh is that it doesn&#8217;t have to rely on sending passwords around.  Instead, you can use public key authentication.  However, even typing in your passphrase can get pretty tedious after a while for every connection.  Enter the ssh-agent.  Just stick <code>eval `ssh-agent`</code> in your startup scripts and then run <code>ssh-add</code> once.  After that, you don&#8217;t get asked for your passphrase any more.  The only caveat is that now you <em>really</em> need to lock your screen when you walk away from it.</p>
<p>Next are the tunnels.  Ssh is able to create network &#8220;tunnels&#8221; in and out of otherwise secure locations.  This is very handy for creating ad-hoc networks.  For example, I&#8217;m allowed to ssh into my work, but not to anything else.  Yet, I can use <a href="http://en.wikipedia.org/wiki/Remote_Desktop_Protocol"><span class="caps">RDP</span></a> to connect to my workstation by running this command:</p>
<pre>
  % ssh -L3389:myworkstation:3389 firewall.mywork.com
  % rdesktop localhost
</pre>
<p>That says: listen on port 3389, and any connections that come in, forward them on to myworkstation port 3389 from the other side of the ssh connection to firewall.mywork.com.</p>
<p>If you&#8217;re on windows, check out <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/">PuTTY</a>.  It&#8217;s got all the features, but wrapped up in a nice <span class="caps">GUI</span> interface.</p>
</li>
<li>
<p><a href="http://people.freebsd.org/~abe/">lsof</a> / <a href="http://docs.sun.com/app/docs/doc/816-5165/6mbb0m9o6?a=view">pfiles</a> / <a href="http://www.freebsd.org/cgi/man.cgi?query=sockstat&#38;sektion=1">sockstat</a></p>
<p>Lsof (List Open Files) is one of the first diagnostic tools that I reach for when I need to understand something.  The purpose is simple: it tells you what files (and network connections) a process has open.  If you&#8217;re wondering where a process is logging to, this might be able to tell you.  Conversely, it can also tell you which processes have a particular file open (usually a lock file).</p>
<p>On Solaris, the pfiles command is similiar.</p>
<p>On a related note, FreeBSD also has the very, very useful sockstat command, which lists all open sockets and what processes hold them open.  The useful bit is that it does this without needing to be root (unlike Linux&#8217;s <code>netstat -anp</code>).</p>
</li>
<li>
<p><a href="http://www.liacs.nl/~wichert/strace/">strace</a> / <a href="http://docs.sun.com/app/docs/doc/816-5165/6mbb0m9ut?a=view">truss</a> / <a href="http://www.freebsd.org/cgi/man.cgi?query=ktrace&#38;sektion=1">ktrace</a></p>
<p>These are the second diagnostic tool that I reach for when something&#8217;s not right.  Unix operating systems have a very clear distinction between userland and kernel, and this tool shows all the points where a program crosses between the two (makes a system call).  If you really want to know how a program is interacting with its environment, these tools will tell you.  It&#8217;s godo for answering questions like:</p>
<ul>
<li>What files is this process opening and closing?</li>
<li>What connections to the network are being made?</li>
<li>What&#8217;s been read in by this program?</li>
</ul>
</li>
<li>
<p><a href="http://www.vanheusden.com/multitail/">multitail</a></p>
<p>A recent addition to my toolbox.  It&#8217;s like <code>tail -f</code>, except that it looks at more than one file at once.  It also does highlighting of search terms.  Dead handy.</p>
</li>
<li>
<p><a href="http://curl.haxx.se/">curl</a></p>
<p>Most of the stuff I do these days involves the web.  Curl is a fantastic little tool for inspecting the web from the command line.  It covers all the protocols you need, and can dump out any information about the transaction.  Want to issue a <span class="caps">PUT</span> request to an <span class="caps">SSL</span> server, verifying the certificate and specifing basic auth?  It&#8217;s got you covered.</p>
</li>
<li>
<p><a href="http://www.vim.org/">vim</a></p>
<p>Everybody needs a good editor.  Vim isn&#8217;t the only choice, but it&#8217;s pretty likely to be available wherever you go.  And once you&#8217;ve started learning how to use it properly, you won&#8217;t go back.  In particular, I can&#8217;t live without <code>^P</code> and <code>^N</code> for doing completion inside the file you&#8217;re editing.</p>
</li>
<li>
<p><a href="http://www.courtesan.com/sudo">sudo</a></p>
<p>If you&#8217;re still using <a href="http://www.freebsd.org/cgi/man.cgi?query=su&#38;sektion=1" title="1">su</a>, then you need help.  Sudo allows you to dole out root access on a much more granular level and you get proper logging of who did what.  If you haven&#8217;t looked at the manual recently, then check out <code>sudo -e</code> for editing a file as another user.  It ensures that you get your regular editor (vim or Emacs) instead of the incredibly unhelpful <a href="http://www.freebsd.org/cgi/man.cgi?query=ed&#38;sektion=1" title="1">ed</a> that root probably defaults to.</p>
</li>
<li>
<p><a href="http://subversion.tigris.org/">subversion</a></p>
<p>Everybody needs version control.  If you&#8217;re editing files, stick them in subversion.  You won&#8217;t regret it.  Particularly when you need to see what those files looked like 6 months ago.</p>
</li>
<li>
<p><a href="http://www.mutt.org/">mutt</a></p>
<p>Every now and again, you need to deal with mailbox files.  Mutt is a great choice for that, thanks to its mini language for filtering mail.  Need delete all mail over 10 days old sent by cron@somehost?  Not a problem.  Even if you don&#8217;t use it on a regular basis, it&#8217;s worth getting familiar with.</p>
</li>
<li>
<p><a href="http://www.gnu.org/software/gdb/">gdb</a></p>
<p>Yes, this is a programmers tool.  But it&#8217;s worth knowing a tiny amount about if you&#8217;re a sysadmin as well.  What for?  It lets you see <em>why</em> something dumped core.  If you find a core file, then do <code>file core</code> to see what program left it behind and then <code>gdb /path/to/program core</code>.  When you&#8217;re inside gdb, type in <code>where</code> and it will (most of the time) give you a stack trace, showing what it was doing at the time of the crash.  This is normally a big help in trying to figure out what went wrong.</p>
<p>You can also use gdb to find out what a running program is doing by specifing a <span class="caps">PID</span> instead of a corefile.</p>
</li>
<li>
<p><a href="http://www.perl.org/">perl</a> / <a href="http://www.python.org/">python</a> / <a href="http://www.ruby-lang.org/">ruby</a></p>
<p>If you perform the same series of actions more than a couple of times, you should consider investing some time in automating the process.  Shell scripts are handy, but can only go so far.  Learning one of these languages will give you a really powerful ability to write your own sysadmin toolbox.</p>
</li>
<li>
<p><a href="http://www.mediawiki.org/wiki/MediaWiki">mediawiki</a></p>
<p>Documentation.  Everybody hates doing it.  Why not make it as easy as possible?  A wiki is the answer to that, and mediawiki is one of the better pieces of wiki software out there.  It&#8217;s pretty simple to get going (although it does depend on MySQL).</p>
<p>Remember: getting it documented is first priority.  Once the information is in the wiki, it can be restructured later.  So long as the information is there, it will be searchable (and hence useful).</p>
</li>
</ul>
<p>Hmmm, that&#8217;s a bit more than the 10 they wanted.  But it&#8217;s a large portion of my regular toolkit.  Hopefully there&#8217;s something useful for other people in there as well&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://happygiraffe.net/blog/2006/04/17/my-sysadmin-toolbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apple+-</title>
		<link>http://happygiraffe.net/blog/2006/04/08/apple/</link>
		<comments>http://happygiraffe.net/blog/2006/04/08/apple/#comments</comments>
		<pubDate>Sat, 08 Apr 2006 00:11:00 +0000</pubDate>
		<dc:creator>Dominic Mitchell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[support]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://happygiraffe.net/2006/04/08/apple/</guid>
		<description><![CDATA[Well, I&#8217;m both annoyed and happy at Apple. Good news first: 10.4.6 fixes my problem with zsh. I would be curious to find out what the fix actually was&#8230; On the bad news, my replacement mouse still hasn&#8217;t turned up. &#8230; <a href="http://happygiraffe.net/blog/2006/04/08/apple/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Well, I&#8217;m both annoyed and happy at Apple.</p>
<p>Good news first: 10.4.6 <a href="http://docs.info.apple.com/article.html?artnum=303411">fixes</a> my <a href="http://happygiraffe.net/blog/archives/2006/02/03/terminal-zsh-process-completed">problem with zsh</a>.  I would be curious to find out what the fix actually was&#8230;</p>
<p>On the bad news, my replacement mouse still hasn&#8217;t turned up.  My wireless mouse stopped working in February.  Apple promised they&#8217;d ship me a new one (after spending an hour on the phone to India).  I watched the tracker on their web site.  The blasted courier company failed to deliver to my workplace, claiming that they&#8217;d tried three times.  I never saw them, nor did anybody else in my office.  So I phoned Apple again, only spending half an hour on the phone to India this time.  They again promised that I&#8217;d be shipped a new mouse.  That was several weeks ago.</p>
<p>Seriously, Apple make some nice kit, but their phone support is atrocious.</p>
]]></content:encoded>
			<wfw:commentRss>http://happygiraffe.net/blog/2006/04/08/apple/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>zsh globbing</title>
		<link>http://happygiraffe.net/blog/2006/02/21/zsh-globbing/</link>
		<comments>http://happygiraffe.net/blog/2006/02/21/zsh-globbing/#comments</comments>
		<pubDate>Tue, 21 Feb 2006 13:19:00 +0000</pubDate>
		<dc:creator>Dominic Mitchell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://happygiraffe.net/2006/02/21/zsh-globbing/</guid>
		<description><![CDATA[I love using zsh&#8212;it&#8217;s full of completely insane features that you wouldn&#8217;t even think of using. Until you come across a situation and think: That&#8217;s exactly what I need! Today&#8217;s example is recursive globbing. How to pick out all the &#8230; <a href="http://happygiraffe.net/blog/2006/02/21/zsh-globbing/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I love using <a href="http://www.zsh.org/">zsh</a>&#8212;it&#8217;s full of completely insane features that you wouldn&#8217;t even think of using.  Until you come across a situation and think: That&#8217;s <em>exactly</em> what I need!</p>
<p>Today&#8217;s example is recursive globbing.  How to pick out all the non-image files in the current directory?  I needed to run docs2unix over them.  You could come up with some evil find command, but in zsh it looks like this:</p>
<pre>
  % dos2unix **/*~*.(gif|png|jpg)(.)
</pre>
<ol>
<li><code>**/*</code> picks out all files and directories, recursively.</li>
<li><code>~*.(gif|png|jpg)</code> excludes images from that list.</li>
<li><code>(.)</code> ensures that only files and not directories are chosen.</li>
</ol>
<p>Easy, peasy.  <code> <img src='http://happygiraffe.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </code></p>
<p><strong>Update</strong>: Even better, case insensitive globbing!</p>
<pre>
  % dos2unix (#i)**/*~*.(gif|png|jpg)(.)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://happygiraffe.net/blog/2006/02/21/zsh-globbing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Terminal, zsh &amp; [Process Completed]</title>
		<link>http://happygiraffe.net/blog/2006/02/03/terminal-zsh-process-completed/</link>
		<comments>http://happygiraffe.net/blog/2006/02/03/terminal-zsh-process-completed/#comments</comments>
		<pubDate>Fri, 03 Feb 2006 22:22:00 +0000</pubDate>
		<dc:creator>Dominic Mitchell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://happygiraffe.net/2006/02/03/terminal-zsh-process-completed/</guid>
		<description><![CDATA[This is mostly a &#8220;me too!&#8221; post, but it&#8217;s been bugging me. Every other time I open a new Terminal window (under OS X Tiger, anyway), I get a [Process Completed] message instead of my shell. According to other people, &#8230; <a href="http://happygiraffe.net/blog/2006/02/03/terminal-zsh-process-completed/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is mostly a &#8220;me too!&#8221; post, but it&#8217;s been bugging me.  Every other time I open a new Terminal window (under <span class="caps">OS X</span> Tiger, anyway), I get a <code>[Process Completed]</code> message instead of my shell.  According to other people, this happens more if you use zsh, and especially if you close the window using &#x2318;-W.  Interestingly, the same problem occurs in <a href="http://iterm.sourceforge.net/">iTerm</a>.</p>
<ul>
<li><a href="http://www.red-sweater.com/blog/48/victory-over-process-completed">Victory over &#8216;[Process Completed]&#8217;!</a> reports that it&#8217;s something to do with ttys.  He also offers a workaround, but it&#8217;s just that, a workaround.</li>
<li><a href="http://gigo.com/archives/Blog/tiger_and_broken_terminals_and_xterms.html">Tigers and broken Terminals and xterms</a> also reports that it&#8217;s pty related.</li>
</ul>
<p>Well, I spent some time with <a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/ktrace.1.html">ktrace</a>, zsh, bash and Terminal.  Sadly, the results aren&#8217;t terribly informative (so far).</p>
<p>First of all, I traced both bash and zsh exiting when &#x2318;-W was pressed.  Neither was particularly interesting.  There were no cleanups that one performed that the other did not.</p>
<p>Next, I traced Terminal (and its child processes) when starting up zsh.  Twice.  The first time everything worked, the second time everything broke.  Now the trace makes the point of breakage plainly clear.  The broken one gets stuck in a loop reading <span class="caps">EOF</span> from file descriptor 17, whereas the working one does not.</p>
<p>Looking back through the trace, file descriptor 17 is opened to <code>/dev/ptyp4</code>.  According to <a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man4/pty.4.html" title="4">pty</a>, that&#8217;s a master pseudo terminal.  It&#8217;s opened inside the Terminal process itself, which then forks, dup2&#8217;s the master pty to fd 0 (stdin) and then exec&#8217;s <code>/usr/libexec/pt_chown</code> (<a href="http://www.freebsd.org/cgi/cvsweb.cgi/src/libexec/pt_chown/pt_chown.c?rev=1.1&#38;content-type=text/x-cvsweb-markup">pt_chown source in FreeBSD</a> should be similiar, judging by strings output).</p>
<p>We don&#8217;t see any output for pt_chown as it&#8217;s setuid root.  But Terminal waits for it to finish, after it&#8217;s presumably corrected the ownership of the slave tty.  Next, fd 18 is opened by Terminal as the slave tty4, Terminal forks and it&#8217;s then dup&#8217;d to stdin, stdout and stderr.  fd 17 is then closed in that process and login is called.</p>
<p>At this point, Terminal&#8217;s got pty4 open, and login&#8217;s got tty4 and it&#8217;s basically a pipe between the two processes.  Except that the kernel is making it look like a genuine 70&#8217;s era serial connection to the slave.</p>
<p>Anyway, it&#8217;s here that the two traces diverge (coming back to the original problem).  The good session reads from the master pty, and then calls stat(2) on tty4.  But it&#8217;s weird as the trace shows no return value for the read call.  <span class="caps">OTOH</span>, the broken trace just shows a return value of <span class="caps">EOF</span> (0 bytes read) and loops around doing that for a few thousand times.</p>
<p>Funnily enough, the trace looks pretty much identical to that which would be produced by program 19.3 in Rich Steven&#8217;s <a href="http://www.kohala.com/start/apue.html"><span class="caps">APUE</span></a> (best book I ever bought).</p>
<p>Sadly, it still hasn&#8217;t gotten me to the bottom of the problem.  But I have refreshed my memory about how pseudo-terminals work.  <img src='http://happygiraffe.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   I suspect that to make further progress, I&#8217;d have to run login under ktrace as well.  I imagine that something is going wrong in there causing it to exit early, which is why the read in the parent returns <span class="caps">EOF</span>.  Even then, I&#8217;m not sure if running it all as root would affect the outcome.  Probably is my guess&#8230;</p>
<p>And no, I will <em>not</em> stop using zsh!</p>
<p><strong>Update:</strong> A useful tip for debugging what your shell is doing at startup under osx.  Add these lines to the top of <code>~/.zshrc</code> (or <code>~/.bashrc</code> if you&#8217;re a luddite <img src='http://happygiraffe.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ):</p>
<pre>
  lsof -p $$ &gt; ~/lsof.out.$$
  ktrace -p $$ -f ~/ktrace.out.$$
</pre>
<p>This still doesn&#8217;t capture what&#8217;s going on in the parent process (login), but it does give you an idea of what the shell is getting up to.</p>
]]></content:encoded>
			<wfw:commentRss>http://happygiraffe.net/blog/2006/02/03/terminal-zsh-process-completed/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OpenSSH &amp; zsh misfeature</title>
		<link>http://happygiraffe.net/blog/2005/10/21/openssh-zsh-misfeature/</link>
		<comments>http://happygiraffe.net/blog/2005/10/21/openssh-zsh-misfeature/#comments</comments>
		<pubDate>Fri, 21 Oct 2005 10:42:00 +0000</pubDate>
		<dc:creator>Dominic Mitchell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://happygiraffe.net/2005/10/21/openssh-zsh-misfeature/</guid>
		<description><![CDATA[For a while, I&#8217;ve been using a little trick that I found on the zsh wiki (CompletionExamples) to automatically turn my known_hosts file into a set of host names. Unfortunately, the latest Ubuntu upgrade has turned on a new feature &#8230; <a href="http://happygiraffe.net/blog/2005/10/21/openssh-zsh-misfeature/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For a while, I&#8217;ve been using a little trick that I found on the zsh wiki (<a href="http://zshwiki.org/CompletionExamples">CompletionExamples</a>) to automatically turn my known_hosts file into a set of host names.  Unfortunately, the latest Ubuntu upgrade has turned on a new feature of OpenSSH, HashKnownHosts (detailed in <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=ssh_config">ssh_config(5)</a>).  Unfortunately, this breaks the parsing because the hostnames are no longer stored in the known_hosts file.</p>
<p>The simple workaround, in my case, was to stick <em>HashKnownHosts no</em> into <code>/etc/ssh/ssh_config</code>.  And now everything&#8217;s back to normal.</p>
<p><strong>Update</strong>: As Aristotle points out below, this is definitely a trade off of security vs convenience.  Don&#8217;t do it if you&#8217;re not happy with the consequences.</p>
]]></content:encoded>
			<wfw:commentRss>http://happygiraffe.net/blog/2005/10/21/openssh-zsh-misfeature/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>zsh editor integration</title>
		<link>http://happygiraffe.net/blog/2005/03/30/zsh-editor-integration/</link>
		<comments>http://happygiraffe.net/blog/2005/03/30/zsh-editor-integration/#comments</comments>
		<pubDate>Wed, 30 Mar 2005 11:37:00 +0000</pubDate>
		<dc:creator>Dominic Mitchell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://happygiraffe.net/2005/03/30/zsh-editor-integration/</guid>
		<description><![CDATA[A top tip from the zsh book: autoload -U edit-command-line zle -N edit-command-line bindkey '\ee' edit-command-line Binds M-e to &#8220;stick this command line in your text editor.&#8221;]]></description>
			<content:encoded><![CDATA[<p>A top tip from the <a href="http://apress.com/book/bookDisplay.html?bID=361">zsh book</a>:</p>
<pre>autoload -U edit-command-line
zle -N edit-command-line
bindkey '\ee' edit-command-line</pre>
<p>Binds M-e to &#8220;stick this command line in your text editor.&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://happygiraffe.net/blog/2005/03/30/zsh-editor-integration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mutt completion in zsh</title>
		<link>http://happygiraffe.net/blog/2005/03/29/mutt-completion-in-zsh/</link>
		<comments>http://happygiraffe.net/blog/2005/03/29/mutt-completion-in-zsh/#comments</comments>
		<pubDate>Tue, 29 Mar 2005 13:56:00 +0000</pubDate>
		<dc:creator>Dominic Mitchell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mutt]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://happygiraffe.net/2005/03/29/mutt-completion-in-zsh/</guid>
		<description><![CDATA[After a little while spent battling with zsh&#8217;s completion system today, I have made it complete my aliases file. My setup is slightly non standard (although not that unusual I think) in that the aliases aren&#8217;t defined in my ~/.muttrc &#8230; <a href="http://happygiraffe.net/blog/2005/03/29/mutt-completion-in-zsh/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After a little while spent battling with zsh&#8217;s completion system today, I have made it complete my aliases file.  My setup is slightly non standard (although not that unusual I think) in that the aliases aren&#8217;t defined in my <code>~/.muttrc</code> file.  Instead, they&#8217;re in <code>~/.mail_aliases</code>.  To get zsh to know about this requires a small function to go in your <code>~/.zshrc</code>:</p>
<pre>_email-mutt() {
    files[$plugin]=~/.mail_aliases
    _email-mail
}</pre>
<p>I managed to get that by looking at the source for the <a href="http://cvs.sourceforge.net/viewcvs.py/zsh/zsh/Completion/Unix/Type/_email_addresses">_email_addresses</a> completion function.  I don&#8217;t know how I could have got by without it.  The <a href="http://www.apress.com/book/bookDisplay.html?bID=361">zsh book</a> should turn up in a few days; maybe that will enlighten me more.</p>
]]></content:encoded>
			<wfw:commentRss>http://happygiraffe.net/blog/2005/03/29/mutt-completion-in-zsh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

