Ubuntu Directory Configuration

Ubuntu will have configuration files, execution files, etc. The contents of each directory are almost the same. Because there’s a set of standards, and we’re going to look at them.

Linux directory configuration basis -FHS

Because there are so many communities/companies and individuals that use Linux for product or development projects, it can cause a lot of administrative headaches if everyone uses their own ideas to configure the directories that are placed. Can you imagine entering an enterprise and being exposed to a completely different way of configuring Linux directories than you were taught? It’s hard to imagine.

Hence the creation of the Filesystem Hierarchy Standard (FHS)!

Their main goal is to let users know where their installed software is usually placed, so they want independent software developers, operating system makers, and users who want to maintain their systems to follow FHS standards. In other words, the focus of the FHS is to regulate what kind of data should be placed in each particular directory. This has a lot of advantages, because Linux is able to develop the unique style that developers want from its existing look (directory architecture unchanged).

In fact, based on past experience, the FHS defines directories as four types of interaction, depending on how frequently the file system is used and whether it allows users to change at will. The table looks something like this:

Variable/share Can share Do not share
immutable /usr (where software is placed) /etc
/opt (Third-party Collaboration software) /boot (Boot and core files)
variable /var/mail (user email address) /var/run (program dependent)
/var/spool/news (newsgroup) /var/lock (program specific)
  • Shareable: a directory that can be shared with other systems for mounting. Therefore, data such as execution files and user emails can be shared with other hosts on the network for mounting.

  • Unshareable: device files running on their own machines or socket files related to programs, etc., are only related to their own machines, so of course it is not suitable to share with other hosts.

  • Invariant: Some data does not change very often, following distribution without change. For example, function libraries, file description files, host service configuration files managed by the system administrator, etc.

  • Mutable: data that changes frequently, such as login files, newsgroups that are accessible to the average user, etc.

FHS only defines what data should be placed at the bottom of the three directories for the directory tree architecture.

/ (root, root directory) : related to the startup system. /usr (Unix software resource) : related to software installation/execution; /var (variable) : relates to the system operation process.Copy the code