本文主要用于解释Unix-like OS中根目录下各个路径的用途。
根目录下必须要有的路径:
-
bin
Essential user command binaries (for use by all users) -
boot
Static files of the boot loader
/boot stores data that is used before the kernel begins executing user-mode programs. -
dev
Device files -
etc
Host-specific system configuration
A "configuration file" is a local file used to control the operation of a program; it must be static.-
/etc/opt
Configuration files for /opt
Host-specific configuration files for add-on application software packages must be installed within the directory /etc/opt/<subdir>
-
-
lib
Essential shared libraries and kernel modules -
media
Mount point for removable media -
mnt
Mount point for mounting a filesystem temporarily -
opt
Add-on application software packages -
run
Data relevant to running processes
This directory contains system information data describing the system since it was booted (like PID files). Files under this directory must be cleared (removed or truncated as appropriate) at the beginning of the boot process. -
sbin
Essential system binaries
Utilities used for system administration (and other root-only commands) are stored in /sbin, /usr/sbin, and /usr/local/sbin.
/sbin contains binaries essential for booting, restoring, recovering, and/or repairing the system in addition to the binaries in /bin.
Programs executed after /usr is known to be mounted (when there are no problems) are generally placed into /usr/sbin.
Locally-installed system administration programs should be placed into /usr/local/sbin. -
srv
Data for services provided by this system -
tmp
Temporary files
Programs must not assume that any files or directories in /tmp are preserved between invocations of the program. -
usr
Secondary hierarchy
/usr is shareable, read-only data. Any information that is host-specific or varies with time is stored elsewhere.-
/usr/bin
Primary directory of executable commands on the system. -
/usr/include
This is where all of the system's general-use include files for the C programming language should be placed. -
/usr/lib
Libraries for programming and packages.
/usr/lib includes object files and libraries.
Applications may use a single subdirectory under /usr/lib. If an application uses a subdirectory, all architecture-dependent data exclusively used by the application must be placed within that subdirectory. -
/usr/lib<qual>
(optional) Alternate format libraries
/usr/lib<qual> performs the same role as /usr/lib for an alternate binary format -
/usr/local
Local hierarchy
Used to install software locally. It needs to be safe from being overwritten when the system software is updated.
Locally installed software must be placed within /usr/local rather than /usr unless it is being installed to replace or upgrade software in /usr.-
/usr/local/bin
Local binaries -
/usr/local/etc
Host-specific system configuration for local binaries -
/usr/local/games
Local game binaries -
/usr/local/include
Local C header files -
/usr/local/lib
Local libraries -
/usr/local/man
Local online manuals -
/usr/local/sbin
Local system binaries -
/usr/local/share
Local architecture-independent hierarchy -
/usr/local/src
Local source code
-
-
/usr/sbin
Non-essential standard system binaries used exclusively by the system administrator. -
/usr/share
Architecture-independent data
This hierarchy is intended to be shareable among all architecture platforms of a given OS; thus, for example, a site with i386, Alpha, and PPC platforms might maintain a single /usr/share directory that is centrally-mounted.
Note, however, that /usr/share is generally not intended to be shared by different OSes or by different releases of the same OS.-
/usr/share/man
Manual pages -
/usr/share/misc
Miscellaneous architecture-independent data
ascii :ASCII character set table (optional)
termcap.db (optional):Terminal capability database
-
-
-
var
Variable data files
/var is specified here in order to make it possible to mount /usr read-only. Everything that once went into /usr that is written to during system operation (as opposed to installation and software maintenance) must be in /var.-
/var/cache
Application cache data -
/var/lib
Variable state information
State information is data that programs modify while they run, is generally used to preserve the condition of an application between invocations and between different instances of the same application. -
/var/local
Variable data for /usr/local -
/var/lock
Lock files for devices and other resources shared by multiple applications -
/var/log
Log files and directories -
/var/opt
Variable data for /opt -
/var/run
Data relevant to running processes
The functions of this directory have been moved to /run.
This directory exists to ensure compatibility with systems and software using an older version of this specification. -
/var/spool
Application spool data
Contains data which is awaiting some kind of later processing. Data in /var/spool represents work to be done in the future (by a program, user, or administrator); often data is deleted after it has been processed. -
/var/tmp
Temporary files preserved between system reboots
For programs that require temporary files or directories that are preserved between system reboots. Therefore, data stored in /var/tmp is more persistent than data in /tmp.
-
根目录下的可选路径:
-
home
User home directories (optional) -
lib<qual>
Alternate format essential shared libraries (optional) -
root
Home directory for the root user (optional)