[Make it clear, to say it! ] Linux system directory structure

Based on Linux directory configuration --- FHS
because use Linux community to develop a product or company too many people, if everyone with their own ideas to the configuration files are placed in the directory, it will cause a lot of trouble on the management, in order to achieve unified management, there Filesystem Hierarchy standard (FHS) standard baked.
According to the FHS standard documents indicated that their main purpose is to allow users to understand the installed software is usually placed under which catalog, so they want independent software developers, operating system makers have wanted to maintain the user's system , we are able to follow the standard of FHS. In other words, FHS focus is under the specifications of each particular directory what data should be placed. This has the advantage very much, because the Linux operating system will be able to (change directory schema) in the face of existing developers want to develop a unique style.
(1) Indeed, FHS is based on past experience under continual revision, FHS based file system used frequently or not at random substitutions and whether to allow the user, and the directory is defined as a form of four kinds of interaction with a bit like this table:
[Make it clear, to say it!  ] Linux system directory structure
the table directory is the directory some representative, four types of the data is placed under the directory represented by:
. a shareable: may be mounted to other systems using shared directory, Therefore, including the implementation of a file to the user's e-mail and other data, to be able to share directories on the network to mount another host used;
b can not be shared: running on your machine configuration file or the socket file and other related procedures, since only with its own machine-dependent, so of course is not suitable for other hosts to share a;
c unchanged: some data is not constantly changing, and follows the distribution changes. Such as libraries, documentation file, the system administrator managed hosting services configuration files;
d can change: frequent changes of data, such as login file, the user can receive general news and other groups.
FHS directory schema defined for a three-set catalog what data it should be placed, are defined under three directories:
/ --- root, root directory, and boot the system related to
/ usr --- unix software resource, and implement relevant software installed
, and the system is running about the / var --- variable
(2) root directory is the most important of the whole system a directory, not only because all directories are all derived from the root, but the root of the boot and also restore, repair and other activities related to the system. Because the software requires specific boot system boot, the core file, start the necessary procedures, libraries, etc. data file, if the system when a system error occurs, the root directory must also include a program to repair the file system of the job. Because the root directory is very important, so in terms of the requirements of the FHS, it hopes not on the root partition very large tank, because the larger the partition slots you can put more data, this way the root directory of the partition slot might have more chance of error.
Therefore, the FHS recommendations: root directory (/) where the partition slot should be as small as possible, and the software applications installed on the same partition is best not to tank the root directory, keeping the root of the smaller the better. So not only better performance, the root directory where the file system is also less prone to problems.
[Make it clear, to say it!  ] Linux system directory structure
/ bin directory --- system has a lot to place executable file, but the / bin rather special, because / bin is placed under the single command in maintenance mode can also be operated. In / bin under the instruction can be used with the root account the general, mainly: cat, chmod, chown, date , mv, mkdir, cp, bash like commonly used commands.
/ boot --- This directory is mainly used in the placement of the opportunity to open the file, including the Linux kernel files and boot options and boot the desired configuration file, and so on. Linux kernel commonly used file named: vmlinuz, if you are using the grub2 boot manager, it will continue to exist / boot / grub2 / directory.
/ dev --- on a Linux system, the interface device is any device in the form of a file in this directory is present among. As long as this through access to a directory under the file, it means access to a device. There are more important source file / dev / null, / dev / zero, / dev / tty, / dev / loop *, / dev / sd * etc
/ etc --- System configuration files almost all major placed within this directory , for example, account password file personnel, services starting stalls and so on. In general, the properties of each file in this directory is that it gives access to the general user, but only root can modify. FHS is not recommended to place an executable file in this directory. There /etc/modprobe.d,/etc/passwd,/etc/fstab,/etc/issue more important documents and so on. FHS specification but several important directory to the presence of / etc / directory: / etc / opt / (placing third-party software in the directory / opt / related profiles); / etc / X11 (X Window associated with each species profiles are all here, especially xorg.conf the X server configuration file); / etc / sgml / (related to SGML format of the configuration file); / etc / xml / (XML format and related items configuration file)
/ lib --- library system is very large, and / lib is placed in the open opportunity to use the library as well as libraries in / bin or / sbin under the instruction of the call. What is the library it? Can be understood as the plug, some of these instructions must be executed before the plug of the successful completion of the program, but also requires the following additional FHS directory must be related to the core swappable modules or drivers to the presence of / lib / modules / (the main directory is placed program)
/ media in the media --- / media device is placed underneath the removable media represent media. Including floppy disk, CD-ROM device, etc. are temporarily mounted here, there is a common file name: / media / floppy /, / media / cdrom / etc.
/ mnt --- after if you want some additional means for temporarily mount it is generally recommended that you can put into this directory, and the directory / media the same, but with the / media, this directory is used to mount a conventional used.
/ opt --- this is for placement of third-party software directory. Such as IBM's DB2 database is installed in this directory.
/ run --- the information specified boot early FHS generated by the system should be placed in / var / run directory under the new version of the specification to FHS / under run. Since / run can use to simulate memory, and therefore will be much better on performance.
/ sbin --- Linux has a lot of commands used to set system environment, these instructions only root can use to set the system, other users can only be used to query it. In / sbin under the boot process is required, which includes the command boot, repair, restore the system needs. For some server software programs, generally placed in the / usr / sbin them. As the file system software execute native install itself produced, are placed into the / usr / local / sbin / them. Common instructions include: fdisk, fsck, ifconfig, mkfs and so on.
/ srv --- can be considered abbreviated service is started after a number of network services, these services require access to the data directory. Common services such as Web, FTP and so on. Page Info Web server needs to be placed in / srv / www / inside. However, service data to the system if it is not available to anyone outside the web browser, it is recommended to place the default to / var / lib / under can.
/ tmp --- to getting the average user or a program is executed temporarily place the file in place. This directory is that anyone can access, you need to regularly clean up. Of course, important data can not be placed in this directory. Because the FHS recommendations at boot time, should you want the data in the / tmp are deleted.
/ home --- this is the default user's home directory. When you add a regular user account, the default user's home directory will be standardized to be here.
/ root --- the system administrator's home directory. The reason here is that if a single person to enter maintenance mode while only mount the root directory, which will be able to have a home directory root, so we want to root's home directory to the root directory of the partition placed in the same slot.
/ lost + found --- This directory is a directory using standard ext2 / ext3 / ext4 file system format will be generated when the object is a file system error occurs, placing some of the lost fragments to this directory. However, if you are using xfs file system, the directory would not exist.
/ proc --- directory itself is a virtual file system, which is placed in data memory which, for example, system status, and other core network status, travel information, the peripheral device. Because the data in this directory are in memory of them, so do not take up any hard disk space itself, the more important documents such as: / proc / cpuinfo, / proc / dma, / proc / interrupts, / proc / ioports, / proc / net *and many more.
/ sys --- in fact, with the directory / proc is very similar, is a virtual file system, the main core is more pertinent records and information systems hardware, including the hardware device information has been loaded kernel modules and core Detected Wait. This directory also does not account for the hard disk capacity.
(3) early in the design of Linux, if a problem occurs, the rescue mode usually mounts only the root of it, so there are five important directories are required by law to be placed together with the root directory, that is, / etc, / bin , / dev, / lib, / sbin five important directories. Now many of the Linux distributions because they have many non-essential file is moved out of / usr, so / usr is more streamlined, and because / usr is mounted read-only advice even though the system can still function properly. So rescue mode can simultaneously mount / usr, so RHEL7 version has the / sbin, / bin, / lib all moved to the / usr under a.
[/ Usr] meaning and content based on the basic definition of the FHS, / usr placed inside the data belongs to share and that can not change, if you know how to mount the partition slots through the network, then / usr really can share other hosts in the local area network is used:
/ usr / bin --- general user can use all of the instructions are placed here, all have now RHEL7 user instruction placed here, the use of the connected stage manner / bin connection So far, that is / usr / bin and / bin are exactly the same, the other FHS requirements in this directory should be no subdirectories.
/ usr / lib --- substantially / lib functions identical, / lib is connected to this directory.
/ usr / local --- the system administrator provides local self-install their own software to download, it is recommended to install this directory, that would be more manageable. For example, software distribution provided by your older, you want to install newer software but do not want to remove the old version, then you can install new software in / usr at / local directory, with the original legacy software respectively.
/ usr / sbin --- Non-system commands needed for the functioning of the system, the most common is web server software service instructions daemon, but the basic function and / sbin similar, so the current / sbin is the link to the directory.
/ usr / share --- mainly placed in read-only architecture, data files, of course, including shared files. Placed in this directory data almost regardless of the hardware architecture of data can be read, because almost all text files. In this directory there are common these sub-directory / usr / share / man (online help files); / usr / share / doc ( document describes software miscellaneous); / usr / share / zoneinfo ( time zone related to the time zone file ) /
usr / games --- data is placed at game-related.
header file / usr / include --- c / c ++ and other programming languages and include files placed at when we * .tar.gz way to install the software, it will be used to include files inside.
/ usr / libexec --- some executable scripts are not conventional or general users, etc., will be placed in this directory. For example, operating under the command of most of the X windows, many of which are placed in this directory.
/ usr / lib64 --- and / lib64 same function, so the current / lib64 is a link to the directory.
/ usr / src --- generally recommend placing the source code here, src denotes a source means. As the core of the original code is recommended to be placed under / usr / src / linux directory.
(4) [/ var meaning and content of] if / usr directory will occupy a larger hard drive capacity of the installation, the / var is in the system directory operations will gradually take up hard disk capacity. Since the / var directory mainly for normality change files, including the file cache (cache), registry (log file), and run some software generated, including program files (lock file, run file), or MySQL database documents. Common subdirectories there:
/ var / Cache --- application itself operation process will produce some temporary files.
/ var / lib --- execution procedure itself, it is necessary to use the data files are placed in directories. In this directory software should have their own directory. For example, MySQL database data to / var / lib / mysql, into the database of the rpm / var / lib / rpm in.
/ var / lock --- some device or file resources can only be used by an application, if the two programs at the same time to use the device, you may have some error conditions, and therefore have the means to locked to ensure that the device will only give a single software used. For example, the burner is to burn a CD, there may be two people burning, and that information should be written Who? So when the first person when burning the burner will be locked, the second person to have the device to be unlocked to be able to continue to use the current directory is moved to / run / lock in.
/ var / log --- very important, which is placed in the log file directory, which is more important files such as / var / log / messages, / var / log / wtmp ( record of landing information)
/ var / mail --- place their personal e-mail directory, but this directory can also be placed in / var / spool / mail directory, which is usually two directories are mutually linked files.
/ var / run --- certain programs or when the service started, the PID will they be placed in this directory. The same / run, this directory is linked to / run went.
/ var / spool --- This directory is usually put some data queue, the queue is queued for so-called data used by other programs, these data are usually used after being removed, for example, receive a new e-mail system will be placed in / var / spool / mail /, the users accept the letter but the message is deleted in principle. If the letter is not being sent out will be placed in / var / spool / mqueue / in, wait until after being sent out is deleted. If the task is to plan, it will be placed in / var / spool / cron / directory.

Guess you like

Origin blog.51cto.com/13613726/2433477