== _head_ versus _sed_ I was recently reading [[More shell, less egg http://www.leancrew.com/all-this/2011/12/more-shell-less-egg/]] and ran across this: > (I can't help wondering, though, why [Doug McIlroy] didn't use _head > -${1}_ in the last line. It seems more natural than _sed_. Is it > possible that _head_ hadn't been written yet?) While _head_ postdates _sed_, this is probably not it. There is an old Unix bias against using _head_ to the point that a lot of old Unix people make a point of avoiding it in favour of _sed_. This isn't a technical issue as much as a cultural issue. _head_ was introduced in 4BSD, and there has always been a reaction against 4BSD that saw it as the point where the core Unix philosophy started being lost. The introduction of a documented command that could as well be a shell script (the [[original version http://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/man/man1/head.1]] only limited things by line) was often seen as yet another example of BSD not really getting the point of things. To put it one way, Unix was not about having a system command for everything; it was about a kind of near-mathematical minimalism. Given _sed_, the basic 4BSD version of _head_ is not minimal at all. (_tail_ was different because you can't duplicate it with _sed_ or anything else feasible; it did a unique job. I suspect that this is part of why _tail_ appears in V7.) I'm not quite old enough in my Unix exposure to have been part of this first hand, but I was apparently exposed to enough old Unix hands at a sensitive age to have picked this up as a reflexive habit. To this day, I use '_sed Nq_' instead of _head_. It just feels (more) right. === Sidebar: would McIlroy have had _head_ available? The short version is 'probably not'. The bit that's being quoted is from 1986, well after 4BSD introduced _head_, but McIlroy was at Bell Labs and was almost certainly using [[Research Unix http://en.wikipedia.org/wiki/Research_Unix]]. While the version of Research Unix from that era used a kernel derived from 4BSD, my impression is that most of the userland programs were basically V7 and I would be somewhat surprised if the Bell Labs people had picked up _head_.