Today's Question:  What does your personal desk look like?        GIVE A SHOUT

Unix directory hierarchy history

  sonic0002        2016-10-21 23:47:17       11,883        1    

As a beginner user of Unix or Linux, people would frequently get confused about the use of different directories of the system. 

For example, there is a /bin directory under root(/), it is used to store binary files. However, there are /usr/bin and /usr/local/bin under /usr which are used for storing binary files as well. Some systems even have /opt/bin. What are the differences among them?

Though there are articles explaining different directories in *nix such as Filesystem Hierarchy Standard, it's not clear why these directories are present and their history. Rob Landley filled part of this gap in an online thread Understanding the bin, sbin, usr/bin , usr/sbin split.

Ken Thompson and Dennis Ritchie created Unix on a PDP-7 in 1969?  Well around 1971 they upgraded to a PDP-11 with a pair of RK05 disk packs (1.5 megabytes each) for storage.

When the operating system grew too big to fit on the first RK05 disk pack (their root filesystem) they let it leak into the second one, which is where all the user home directories lived (which is why the mount was called /usr).  They replicated all the OS directories under there (/bin, /sbin, /lib, /tmp...) and wrote files to those new directories because their original disk was out of space.  When they got a third disk, they mounted it on /home and relocated all the user directories to there so the OS could consume all the space on both disks and grow to THREE WHOLE MEGABYTES. And thereafter /usr is used to store user programs while /home is used to store user data.

With the evolution of *nix system, the definitions for different directories become clearer. 

  • / : Store system programs(developed by AT&T)
  • /usr : Store vendor programs(IBM and HP etc)
  • /usr/local : User installed programs
  • /opt : Store third party programs
  • /tmp : Store temporary files. 
  • /var : Store files to which the system writes data during the course of its operation. For example, log files.
  • /bin : Store essential binary files for booting. It usually contains the shells like bash and commonly used commands like cp, mv, rm, cat, ls. 
  • /sbin : Store system binary files like reboot, grub.

Reference : http://www.ruanyifeng.com/blog/2012/02/a_history_of_unix_directory_structure.html

LINUX  HISTORY  UNIX  FILESSYTEM  DIRECTORY HIERARCHY 

Share on Facebook  Share on Twitter  Share on Weibo  Share on Reddit 

  RELATED


  1 COMMENT


Anonymous [Reply]@ 2017-05-06 03:59:27

Great this is an enlightening story!