Linux directory structure FHS notes

Hierarchy Standard Filesystem (Filesystem Hierarchy Standard, FHS) in accordance with the standard file system used frequently or not and whether the user allowed to speak freely modifiers, and the directory defined form four kinds of interactions, as follows: share: You can mounted to other systems sharing use of the directory, the execution file including the user data such as e-mail, to be able to share the directory on the network used to mount other hosts; not sharing: means for operation of the machine above their files or programs with related socket files, etc., as only related to their own machine, so of course is not suitable for other hosts to share a. Unchanged: Some data is not constantly changing, followed by distribution without changes. Such as libraries, documentation file, the system administrator managed hosting configuration files, and so on; can change: constantly changing data, such as the log file, the general user can accept the newsgroups. 
 
 
 
 

Indeed, FHS directory tree for architecture defines only the next three catalog what data should be placed, are the following three directories:
  • / (Root): related to boot the system;
  • / Usr (unix software resource): software installation and implementation of relevant;
  • / Var (variable): related to the operation of the process system.

 


 
A, / (root)
       The root directory is the most important one of the whole system, not only because all directories are derived from the root directory, but also the root of the boot / restore / repair systems and other related actions. Because the software requires specific boot system boot, the core file, start the necessary procedures, libraries and so on archival data, if 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 so important in terms of the requirements of FHS, we do not want the root of the division on a very large tank, since the greater the dividing grooves will put more and more data, this way the root directory where the dividing groove on there would be more chance for error occur.
  Thus Typically, where the dividing groove root should be as small as possible, and the software application installed preferably not on the same groove with a split root directory, the root directory maintained as small as possible. So not only better performance, while the root directory where the file system is also less likely to release the error.
  FHS root directory should have defined the introduction of sub-directories is as follows:
 
1./bin
Directory, also known as binary directory that contains the binary image of those important linux commands for system administrators and ordinary users. The contents of the directory store include various executable files, executable files as well as some symbol of connection. Commonly used commands are: cp, dmesg, kill, login, rm, ping, chomd, bash, cat, echo, ls, mail, vi and so on.
 
2./boot
Directory and file storage system core files must be read at startup, including Linux kernel binary image.
 
3./dev
Directory holds external device code files, these files are special, in fact they are directed peripheral devices represented, such as terminals, disk drives, optical drives, printers and the like. You can access these external devices, there is no difference between accessing a file or a directory.
 
/ Dev / cdrom CD-ROM directory
/ Dev / console console
/ Dev / fd Floppy
/ Dev / hd a partition on the hard disk
/ Dev / lp0 printer
/ Dev / ttyS0 serial device system
/ Dev / dsp speaker apparatus system
 
4./etc
This directory is the center of the entire Linux system, which contains all system administration and maintenance of configuration files, such as dhcpd.conf, host.conf, logrotate.conf, man.config, mke2fs.conf, modprobe.conf, resolv.conf, sysctl.conf, syslog.conf (or rsyslog.conf), xinetd.conf yum.conf and the like, other configuration files are located in a separate subdirectory. Usually you should pay attention to back up important configuration files in this directory to be able to quickly restore the system if necessary. In addition to the relevant files and configuration files for a specific host storage system. For example, records the user's account name password file, the password projected shadow files. The directory does not contain any binary files, and all files in that directory is primarily used by administrators, ordinary users only have to read their rights. The directory further contains network configuration file, the file system, x system configuration files, device configuration information, user setting information and the like.
 
/etc/dhcpd.conf DHCP service configuration file
/etc/host.conf resolver query sequence profile, different from the / etc / hosts (IP and storage of correspondence between the domain name of a text file)
/etc/logrotate.conf logrotate (log file management tool) profiles
/etc/man.config  
/etc/mke2fs.conf mke2fs (Disk Format) command configuration file
/etc/modprobe.conf modprobe (automatic processing loadable module) command profile
/etc/resolv.conf DNS domain name resolution configuration file
/etc/sysctl.conf some system information configuration files, correspondence files and subdirectories in / proc / sys / directory of
syslogd process /etc/syslog.conf (or rsyslog.conf) Profiles
/etc/xinetd.conf xinetd (used to manage multiple small network service) Service Profiles
/etc/yum.conf yum configuration file
 
/etc/cron.d used to configure and control file storage process is scheduled to run cron daemon used. Other directories include / etc / crontab file defines cron.hourly, cron.daily, cron.weekly and cron.monthly four directories.   
/ Etc / cups used for storing various configuration files Common UNIX Printing System (Commom UNIX Printing System, CUPS) used.
/ Etc / default file for providing a portion where tools (e.g. useradd) use a default value and variable.
/ Etc / httpd root directory of the Apache configuration file. Apache is a versatile, high-performance HTTP server, is the world's most popular Web server. Apache uses a modular design approach to support dynamic run-time module selection, web hosting, and service process number of dynamic adjustment.
Need a script file executed by init Dispatched when /etc/init.d for storing enter the corresponding operational level. In Fedora 
Linux system, this is just a symbolic link file, the actual directory should be /etc/rc.d/init.d.
/etc/ipsec.d for use profile storing IPSee the like.
/ Etc / kde initialization file which contains the KDE and KDM profile.
/ Etc / pki for storing various keys, such as keys for the installation package and the like.
/ Etc / ppp PPP for storing scripts and configuration files.
/etc/profile.d for storing / etc / profile and other auxiliary initialization files, such as lang.sh script files.
/etc/rc.d for storage into the corresponding run-level script file is executed by the init process scheduling. Init.d and the like which contains subdirectories rcN.d (where N is 0,1,2,3,4,5, and 6, showing operation of the system level).
Root directory / etc / samba Samba configuration file. Samba is a general term for network sharing software, SMB protocol implemented in the Linux system, allows Linux systems to provide file and print sharing for Windows system services.
/ Etc / security file basic safety control user storage, including registration control files, control file access control, resource constraints and control files.
/ Etc / selinux SElinux (Security Enhanced Linux, GPL project led by the development of the US National Security (National Security Agency), it has a flexible mandatory access control architecture, designed to improve the security of Linux systems, providing robust security guarantees, protects against unknown attacks, allegedly equivalent to the B1 level of military security. MSNT much high than the so-called C2. after applying SELinux, you can mitigate the disaster malicious attacks or malicious software, and to provide for confidentiality and have high integrity high information security requirements.) root directory of the configuration file.
/ Etc / skel where there default initialization files, such as .bash_logout, .bash_profile, .bashrc, .emacs, .kde and .zshrc and so on. Whenever add a new user, the system will copy the part where the initialization file to the user's home directory. Note: The above documents are hidden files. (Ie. "" Beginning of the file name)
/ Etc / ssh directory contains system configuration, system boot and various configuration files needed during various back-end service process is the root chkconfig maintain configuration files. For example, where the file containing the system clock time zone setting, Keyboard type definition file contains the keyboard, init parameter definition file system contains the boot during use and the like.
/ Etc / tomcat5 tomcat root directory
/ Etc / vsftpd FTP server contains profiles, including vsftpd.conf, ftpusers user_list and other important documents.
/etc/xinetd.d which profiles all the traditional use of network services include xinetd service process control, in particular, it contains configuration files telnet and other network applications. On Linux systems, the original has been more powerful inetd xinetd service process replaced the original inetd.conf configuration file can also be replaced by a series of individual profiles xinetd.d directory.
/ Etc / yum yum software update tool which contains configuration files used.
/etc/yum.repos.d which contains configuration files for each depot.
 
5./lib
Storing the necessary runtime directory, mainly programming language library. A typical Linux operating system contains C, C ++ and Fortran libraries. Application developers use these languages ​​can use these programming language library file. This allows software developers to take advantage of those pre-written and tested functions. Other shared libraries used library file contains the standard C library /lib/libc.so.*, math library libm.so. *, shared dynamic link library / lib / ld / so and directory / bin and / sbin down . / Lib / modules directory storage system's core modules, some of which may be part of a modular core body does not need to put in the system kernel compile, avoid body too large and result in reduced efficiency.
 
/ Lib / modules placed in the core of the associated module (driver)
/ Lib / crda / pubkey placed a number of public key cryptography
/ Lib / systemd to store some system scripts, such as shutdown, sleep
/ Lib / console driver installer is placed some (sh files), e.g. keyboard-setup.sh
/ Lib / live / config there are 0031-root-password, use the cat you can see the root password
 
6./lost+found
The directory to store all the files and other directories are not associated. When a system error or a problem, Fedora will automatically scan the disk drives, fix bugs, if missing or incorrect fragment found these fragments converted into a file stored here, waiting for further processing administrator.
 
7. /mnt
The directory is the default file system temporary mount point, which is a common installation point, you can temporarily install any file system or remote resources. The system administrator performs the mount 
command to complete the work load. In the system, this directory contains mount points CD-ROM, floppy disk and.
 
8./home
The default user's home directory, when adding a regular user account management, the default user's home directory will be the norm here.
/ Home / ~ on behalf of the current user's home directory
/ Home / ~ dmtsai on behalf of the home directory dmtsai
 
9./root
The system administrator (root) home directory
 
10./media
Removable means (e.g., a floppy disk, CD-ROM, DVD, etc.) of the mount point
 
11./opt
Directory is used to install additional packages, the user invokes the software package placed in the directory / opt / package_name / bin, package_name is the name of the installation package.
 
12./sbin
Directory / sbin, / usr / sbin and / usr / local / sbin storing a program to be executed when the directory to start the system, such as management tools, applications and generic root user authority to order and so on. As comprises getty, init, update.
 
13./srv
Internet service required for startup directory data is stored.
 
14./tmp
Average user or program being implemented temporary file storage directory / file can not store important data.
 
15./sys
Kernel and system information of the virtual file system. Stored information about the devices, drivers, and some kernel characteristics. Its underlying structure, does not specify otherwise decided by the Linux kernel currently in use.
 
/ Sys / devices in this device is a global directory structure system, registration is found to contain all of the various physical devices on the various buses. In general, all physical devices on its bus topology is shown, but with two exceptions, namely platform devices and system devices. platform devices are generally hung on the chip's internal bus to tell the low speed or various controllers and peripherals, they can be addressed directly to the CPU; system devices not peripheral, but the core structure inside the chip, such as CPU, etc. Timer they generally do not have the relevant drivers, but there will be some architecture-dependent code to configure them. (Sys / devices is the kernel of the system model expressed in different levels all the equipment, but also the / sys directory structure of the most important file system management device).
/ Sys / dev This directory maintenance in accordance with a number of primary and secondary character and block devices: Link to (major minor) file is really a symbolic link device (/ sys / devices) are.
/ Sys / class registered in the kernel which contains all the types of devices in the directory, which is in accordance with functional classification of the device model of the device, each device having a device type expressing one function. Under each device type subdirectory are symbolic links to a variety of specific types of equipment that device, which links to specific devices under / sys / devices / name. The device type and device is not one to one relationship, the physical device may have a plurality of device types; a device having a device type expressing only one function, for example: all system devices will appear in the input / sys / class / input of next, whether they are based on what is connected to the bus system. (/ Sys / class also form part of a unified linux device models)
/ Sys / block all subdirectories of the directory in the system represents all devices currently found in the block. By function is placed under / sys / class would be more appropriate, but because of the historical legacy of factors have been present in the / sys / block, but linux2.6.22 start this part of the kernel has been marked as the past, only to open the configuration CONFIG_SYSFS_DEPRECATED will have compiled this list exists, and the contents of which start from linux2.6.26 version has officially moved to the / sys / class / block, the old interface / sys / block reserved for backward compatibility exist, but the content has they point to become the real device in / sys / devices / symbolic link file.
/ sys / bus each subdirectory of the directory is kernel support and has registered bus type. This is a kernel type of device is placed in a hierarchical directory structure in accordance with the bus, all the equipment / sys / devices are connected to the bus under certain, specific for each bus under the subdirectory of the bus can be found in each particular device symbolic link, generally comprising each subdirectory (bus type) two subdirectories, one devices, and the other is Drivers; wherein the devices are all devices in the bus type, these devices are symbolic links, which are real pointing device (/ sys / devices / name / down); and the lower drivers are registered in all the bus drivers, each driver under a number of subdirectories may be observed and modified driver parameters. (It also forms part of a unified linux device models)
/ Sys / fs By design, the directory uses to describe all the file systems in the system, including the file system itself and in accordance with the file system has been classified storage mount point.
/ Sys / kernel store all adjustable parameters kernel
/ Sys / fireware comprising interface objects firmware (firmware object) and observation of the operation and properties of the directory, i.e., where the system loading mechanism firmware interface user space. (About firmware dedicated to firmware loaded set of API )
/ Sys / hypervisor that directory is associated with the Xen virtualization device. (The Xen is an open-source virtual machine monitor)
/ Sys / module has all the modules in the directory information systems, whether these modules are inline (inlined) compiled into the kernel image file is compiled as a module outside (.ko file), it may appear in the / sys / module in. That is the next module directory contains all of the kernel module is loaded.
/ Sys / power supply option is the system directory, the description of the power subsystem is used. There are several attributes files in this directory can be used to control the entire machine power state, as can be written to the control command wherein the machine shutdown / restart, etc.
 
16./proc
Proc process file system root directory, which is part of the file corresponding to a running process, can be used to access the current process's address space. It is a very special virtual file system, which does not contain "real" file, but the system can be used to reference information about the current operation of the system, such as CPU, memory, uptime, software configuration and hardware configuration information, which in memory is generated by the system of their own.
 
/ Proc / net, respectively, showing a state where the document various network protocols (such as TCP, UDP and ARP, etc.) and statistics.
/ Proc / sys This directory is not only there are a variety of system information, but also includes system kernel and TCP / IP network adjustable parameters. Wherein the kernel subdirectory containing shared memory and message queue tunable parameters, net subdirectory contains TCP / IP various adjustable parameters. For example, the maximum SHMMAX shared memory file containing the definition of the system, if the "echo somevalue> / proc / sys / kernel / shmmax" command, can directly modify the operating system kernel parameters without the need to reboot the system. This approach to be careful, some files may contain multiple values, or values ​​of different types, therefore, before editing must understand the meaning and the actual value of the parameter. In order to be able to use customized system every time you start the system tunable parameters can be set sysctl.conf configuration file, or write your own Shell startup script.
 
In Linux, because the root directory of the boot related to the boot process, only the root directory will be mounted, it is only continuing to mount behavior at boot after the completion of other dividing groove. Therefore, the root directory of the boot process can be related to the directory not divided into different slots and root directory. The following five directories is inextricably linked with the boot can not be separated from the root directory.
/ Etc: Configuration Files
/ Bin: executable important. Instructions related to the general user and single-mode operation.
/ Dev: device-related profile and interface configuration
/ Lib: file required to execute the required libraries and core modules
/ Sbin: instructions related to operating the system administrator
 
Two, / usr
The definition of the FHS, / usr placed inside belonging to share data but not the data changes. Similar to the Windows systems C: \ Windows and C: \ Program Files synthesis of these two directories. It recommends that all software developers will sound their data were placed in the sub-directory under this directory, instead of creating their own independent directory of the software itself.
1./usr/X11R6
Important data for the X Window System is placed in the directory.
 
2./usr/bin
Storage applications. The difference between / bin is whether the boot processes.
 
3./usr/include
Putting Linux compile the application under development and header files needed.
 
4./usr/lib
Contains the application's library, the target file (object file), and the executable file or script (script) is not the usual average user. Some software will provide some special instructions to set the server, these instructions will not always be the operating system administrator, it will be put to this directory. If the system is X84_64 Linux system, there is / usr / lib64 directory generated.
 
5./usr/local
The system administrator to install their own software downloaded in their own native place.
 
6./usr/sbin
Non-system commands needed for the functioning of the system, as some of the most common Web server software service order (deamon).
 
7./usr/share
A place to put shared files placed in this directory data almost regardless of the hardware architecture of the data can be read. This common directory as follows:
/ Usr / share / man system help files
File / usr / share / dooc miscellaneous software instructions
/ Usr / share / zoneinfo time zone-related lost files
 
8./usr/src
Linux open source storage directory. The core source code is recommended to be placed under / usr / src / linux / directory.
 
三, / was
/ Var directory mainly for normality change files, including cache (cache), Log file (log file), and certain software files generated by the operation, including program files (lock file, run file), or database such as MYSQL files, and so on. In simple terms that is constantly changing store a lot of files, such as log files and so on. Common subdirectories are:
1./var/cache
The operation of the application process itself produced some of the temporary file.
 
2./var/lib
During program execution itself, it is necessary to use data files are placed in the directory. In this directory software should have their own directory. For example, Mysql database data to / var / lib / mysql / rpm database into the / var / lib / rpm.
 
3./var/lock
Some devices or archival resources can only be used by an application, if there are two programs at the same time to use the device, you may have some error conditions, and therefore the device will lock (lock), to ensure that the device will only give a single software used.
 
4./var/log
Log files are placed directory.
 
5./var/mail
Placing personal e-mail directory, and this directory can also be placed under / var / spool / mail / directory, usually two directories mutually linked files.
 
6./var/run
After some program or service is started, its PID will be placed in this directory.
 
7./var/spool
Put some data queue, the queue is queued for so-called data used by other programs. These data are used usually deleted.
 
In summary FHS is the standard, then, we have the entire directory tree with an icon to display method, and more important data files listed.

 

Guess you like

Origin www.cnblogs.com/dumpling-z/p/11223112.html