Unix (including Linux) beginners, often confused, do not understand the meaning of the directory structure.
For example, there is a subdirectory under the root directory,/bin, for storing binaries. However, the/USR subdirectory also contains/usr/bin, as well as/usr/local/bin, which is also used to store binaries, and some systems even have/opt/bin. What is the difference between them?
For a long time, I have also been puzzled, do not understand why this design. Like most people, I just memorize the differences between directories based on the UNIX File system architecture standard (Filesystem Hierarchy).
Yesterday, I read the short explanation of Rob Landley, which dawned on the fact that the UNIX directory structure was historically created.
In 1969, Ken Thompson and Dennis Ritchie invented Unix on minicomputer PDP-7. In 1971, they upgraded the mainframe to PDP-11.
At the time, they used a storage disk called RK05, with a volume of about 1.5MB.
It wasn't long before the operating system (the root directory) became larger and bigger, and a disk was not fit. As a result, they added a second set of RK05, and stipulated that the first disk specifically put the System program, the second disk dedicated to the user's own program, so mount Directory point named/usr. That is, the root directory "/" is mounted on the first disk, and the "/usr" directory is mounted on the second disk. In addition, the directory structure of the two disks is identical, the first disk directory (/bin,/sbin,/lib,/tmp ... ) appears again in the/usr directory.
Later, the second plate is full, they have to add a third set of RK05, the directory is mounted to the name of home/home, and specify/usr for storing the user's program,/home for storing the user's data.
Since then, this directory structure has continued. As hard disk capacity becomes larger, the meanings of each directory are further clarified.
- /: Storage System program, which is the UNIX program developed by T/T.
- /usr: programs developed by UNIX system vendors, such as IBM and HP.
- /usr/local: Store the user's own installed program.
- /OPT: In some systems, it is used to store programs developed by third-party vendors, so it is named option, meaning "optional".
The origin of the UNIX directory structure