The not so secret origins of /usr/bin and /usr/sbin (and /sbin)

July 17, 2008

Once upon a time, Unix was very small and fit entirely in what is now the root filesystem, /; hence, among other things, /bin, which was where commands went. This didn't last very long, and by the time of at least the Third Edition in 1973, there was an additional /usr filesystem with a /usr/bin for 'overflow' programs that didn't fit on the root filesystem any more.

(As I heard the story, the root filesystem was deliberately set up to contain everything you needed to rebuild at least the kernel, in case you booted a kernel that couldn't mount the user filesystem. Hence as late as V7 Unix you could find the C compiler as /bin/cc and so on.)

I'm not sure if very many things migrated from /bin to /usr/bin, or if it was just that after a certain point normal programs stopped being added to /bin. There was probably a mix of both, with the shrinkage driven by pressure to keep the root filesystem small and an ever-increasing set of programs that were necessary to boot the system to the point where it could mount /usr.

(Sun was a major contributor to the growth of /bin when they made it possible to have diskless machines, especially with NFS. When you NFS-mount /usr, a whole lot of network programs suddenly need to be on the root filesystem.)

Of course, /usr/bin and /bin continued to grow as people added more and more programs to Unix (and booting got more complicated), which people didn't like. At some point someone noticed that a lot of these commands weren't useful for ordinary users (so much so that their manpages were in an entirely different section of the manual from user commands), and had the good idea of moving them to new directories. Thus were /sbin and /usr/sbin born; the 's' is traditionally said to stand for 'system'.

(I suspect that the sbin directories were introduced by Sun, probably in SunOS 4. Sun has been responsible for a surprisingly large number of the rationalizations and complications of the Unix directory hierarchy over the years.)

Once consequence of this was that a whole bunch of system programs that had been scattered in places like /etc and /usr/lib got rationalized into /usr/sbin and /sbin, which is generally a good thing even if I sometimes still try to run /usr/lib/sendmail by reflex.

(What makes my use of /usr/lib/sendmail even more perverse is that I'm not even trying to run Sendmail. For years typing '/usr/lib/sendmail -bt' was the way I fired up our local mailer's debugging mode, and the reflex still lurks in my fingers.)

Written on 17 July 2008.
« The problem with Usenet
The advantage of blog comments »

Page tools: View Source.
Search:
Login: Password:

Last modified: Thu Jul 17 00:21:52 2008
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.