[UNIX] Understanding the bin, sbin, usr/bin, usr/sbin split
As Unix users, we know there are so much paths in our system. From / to /home, etc, etc. And you knew these paths are assigned to particular files and folders. For example, /home is home users directories while /opt is the path for packages installed. But, how did it went like that? And why?
Rob Landley, who maintain Linux Firmware and an ex-maintainer of BusyBox, is trying to tell us the story behind these paths. Quoting from his explanation:
Of course once the split existed, some people made other rules to justify it. Root was for the OS stuff you got from upstream and /usr was for your site-local files. Then / was for the stuff you got from AT&T and /usr was for the stuff that your distro like IBM AIX or Dec Ultrix or SGI Irix added to it, and /usr/local was for your specific installation’s files. Then somebody decided /usr/local wasn’t a good place to install new packages, so let’s add /opt! I’m still waiting for /opt/local to show up…
Of course given 30 years to fester, this split made some interesting distro-specific rules show up and go away again, such as “/tmp is cleared between reboots but /usr/tmp isn’t”. (Of course on Ubuntu /usr/tmp doesn’t exist and on Gentoo /usr/tmp is a symlink to /var/tmp which now has the “not cleared between reboots” rule. Yes all this predated tmpfs. It has to do with read-only root filesystems, /usr is always going to be read only in that case and /var is where your writable space is, / is mostly read only except for bits of /etc which they tried to move to /var but really symlinking /etc to /var/etc happens more often than not…) Later on, there are some changes.
You can read complete Rob’s explanation here.
image: glasbergen.com