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?

Understanding Unix

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:

”.. when the system first boots, it has to come up enough to be able to mount the second disk on /usr, so don’t put things like the mount command /usr/bin or we’ll have a chicken and egg problem bringing the system up.”

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.