HFS学习总结
HFS Learning Summary
Reference:
一、Root Filesystem
The following directories, or symbolic links to directories, are required in /.
| Directory | Description |
|---|---|
bin |
Essential command binaries |
boot |
Static files of the boot loader |
dev |
Device files |
etc |
Host-specific system configuration |
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 |
sbin |
Essential system binaries |
srv |
Data for services provided by this system |
tmp |
Temporary files |
usr |
Secondary hierarchy |
var |
Variable data |
home |
User home directories (optional) |
lib<qual> |
Alternate format essential shared libraries (optional) |
root |
Home directory for the root user (optional) |
二、The /usr Hierarchy
The following directories, or symbolic links to directories, are required in /usr.
| Directory | Description |
|---|---|
bin |
Most user commands |
lib |
Libraries |
local |
Local hierarchy (empty after main installation) |
sbin |
Non-vital system binaries |
share |
Architecture-independent data |
三、The /var Hierarchy
The following directories, or symbolic links to directories, are required in /var.
| Directory | Description |
|---|---|
cache |
Application cache data |
lib |
Variable state information |
local |
Variable data for /usr/local |
lock |
Lock files |
log |
Log files and directories |
opt |
Variable data for /opt |
run |
Data relevant to running processes |
spool |
Application spool data |
tmp |
Temporary files preserved between system reboots |
account |
Process accounting logs (optional) |
crash |
System crash dumps (optional) |
games |
Variable game data (optional) |
mail |
User mailbox files (optional) |
yp |
Network Information Service (NIS) database files (optional) |
Several directories are `reserved’ in the sense that they must not be used arbitrarily by some new application, since they would conflict with historical and/or local practice. They are:
1 | /var/backups |
四、Operating System Specific Annex
1. /:Root directory
On Linux systems, if the kernel is located in /, we recommend using the names vmlinux or vmlinuz, which have been used in recent Linux kernel source packages.
2. /bin : Essential user command binaries (for use by all users)
3. /dev : Devices and special files
The following devices must exist under /dev:
- /dev/null
- /dev/zero
- /dev/tty
4. /etc : Host-specific system configuration
5. /proc : Kernel and process information virtual filesystem
6. /sbin : Essential system binaries
7. /sys : Kernel and system information virtual filesystem
8. /usr/include : Header files included by C programs
These symbolic links are required if a C or C++ compiler is installed and only for systems not based on glibc.
1 | /usr/include/asm -> /usr/src/linux/include/asm-<arch> |
9. /usr/src : Source code
For systems based on glibc, there are no specific guidelines for this directory. For systems based on Linux libc revisions prior to glibc, the following guidelines and rationale apply:
The only source code that should be placed in a specific location is the Linux kernel source code. It is located in /usr/src/linux.
If a C or C++ compiler is installed, but the complete Linux kernel source code is not installed, then the include files from the kernel source code must be located in these directories:
1 | /usr/src/linux/include/asm-<arch> |
<arch> is the name of the system architecture,/usr/src/linux may be a symbolic link to a kernel source code tree.
五、Appendix
Here are some of the guidelines that have been used in the development of this standard:
- Solve technical problems while limiting transitional difficulties.
- Make the specification reasonably stable.
- Gain the approval of distributors, developers, and other decision-makers in relevant development groups and encourage their participation.
- Provide a standard that is attractive to the implementors of different UNIX-like systems.
