diff --git a/sources/tech/20150813 Linux file system hierarchy v2.0.md b/sources/tech/20150813 Linux file system hierarchy v2.0.md deleted file mode 100644 index 23f70258b1..0000000000 --- a/sources/tech/20150813 Linux file system hierarchy v2.0.md +++ /dev/null @@ -1,440 +0,0 @@ -translating by tnuoccalanosrep - -Linux file system hierarchy v2.0 -================================================================================ -What is a file in Linux? What is file system in Linux? Where are all the configuration files? Where do I keep my downloaded applications? Is there really a filesystem standard structure in Linux? Well, the above image explains Linux file system hierarchy in a very simple and non-complex way. It’s very useful when you’re looking for a configuration file or a binary file. I’ve added some explanation and examples below, but that’s TL;DR. - -Another issue is when you got configuration and binary files all over the system that creates inconsistency and if you’re a large organization or even an end user, it can compromise your system (binary talking with old lib files etc.) and when you do [security audit of your Linux system][1], you find it is vulnerable to different exploits. So keeping a clean operating system (no matter Windows or Linux) is important. - -### What is a file in Linux? ### - -A simple description of the UNIX system, also applicable to Linux, is this: - -> On a UNIX system, everything is a file; if something is not a file, it is a process. - -This statement is true because there are special files that are more than just files (named pipes and sockets, for instance), but to keep things simple, saying that everything is a file is an acceptable generalization. A Linux system, just like UNIX, makes no difference between a file and a directory, since a directory is just a file containing names of other files. Programs, services, texts, images, and so forth, are all files. Input and output devices, and generally all devices, are considered to be files, according to the system. - - - -- Version 2.0 – 17-06-2015 - - – Improved: Added title and version history. - - – Improved: Added /srv, /media and /proc. - - – Improved: Updated descriptions to reflect modern Linux File Systems. - - – Fixed: Multiple typo’s. - - – Fixed: Appearance and colour. -- Version 1.0 – 14-02-2015 - - – Created: Initial diagram. - - – Note: Discarded lowercase version. - -### Download Links ### - -Following are two links for download. If you need this in any other format, let me know and I will try to create that and upload it somewhere. - -- [Large (PNG) Format – 2480×1755 px – 184KB][2] -- [Largest (PDF) Format – 9919x7019 px – 1686KB][3] - -**Note**: PDF Format is best for printing and very high in quality - -### Linux file system description ### - -In order to manage all those files in an orderly fashion, man likes to think of them in an ordered tree-like structure on the hard disk, as we know from `MS-DOS` (Disk Operating System) for instance. The large branches contain more branches, and the branches at the end contain the tree’s leaves or normal files. For now we will use this image of the tree, but we will find out later why this is not a fully accurate image. - -注:表格 -
| Directory | -Description | -
|---|---|
|
- Primary hierarchy root and root directory of the entire file system hierarchy. | -
|
- Essential command binaries that need to be available in single user mode; for all users, e.g., cat, ls, cp. | -
|
- Boot loader files, e.g., kernels, initrd. | -
|
- Essential devices, e.g., /dev/null. |
-
|
- Host-specific system-wide configuration filesThere has been controversy over the meaning of the name itself. In early versions of the UNIX Implementation Document from Bell labs, /etc is referred to as the etcetera directory, as this directory historically held everything that did not belong elsewhere (however, the FHS restricts /etc to static configuration files and may not contain binaries). Since the publication of early documentation, the directory name has been re-designated in various ways. Recent interpretations include backronyms such as “Editable Text Configuration” or “Extended Tool Chest”. | -
|
- Configuration files for add-on packages that are stored in /opt/. |
-
|
- Configuration files, such as catalogs, for software that processes SGML. | -
|
- Configuration files for the X Window System, version 11. | -
|
- Configuration files, such as catalogs, for software that processes XML. | -
|
- Users’ home directories, containing saved files, personal settings, etc. | -
|
- Libraries essential for the binaries in /bin/ and /sbin/. |
-
|
- Alternate format essential libraries. Such directories are optional, but if they exist, they have some requirements. | -
|
- Mount points for removable media such as CD-ROMs (appeared in FHS-2.3). | -
|
- Temporarily mounted filesystems. | -
|
- Optional application software packages. | -
|
- Virtual filesystem providing process and kernel information as files. In Linux, corresponds to a procfs mount. | -
|
- Home directory for the root user. | -
|
- Essential system binaries, e.g., init, ip, mount. | -
|
- Site-specific data which are served by the system. | -
|
- Temporary files (see also /var/tmp). Often not preserved between system reboots. |
-
|
- Secondary hierarchy for read-only user data; contains the majority of (multi-)user utilities and applications. | -
|
- Non-essential command binaries (not needed in single user mode); for all users. | -
|
- Standard include files. | -
|
- Libraries for the binaries in /usr/bin/ and /usr/sbin/. |
-
|
- Alternate format libraries (optional). | -
|
- Tertiary hierarchy for local data, specific to this host. Typically has further subdirectories, e.g., bin/, lib/, share/. |
-
|
- Non-essential system binaries, e.g., daemons for various network-services. | -
|
- Architecture-independent (shared) data. | -
|
- Source code, e.g., the kernel source code with its header files. | -
|
- X Window System, Version 11, Release 6. | -
|
- Variable files—files whose content is expected to continually change during normal operation of the system—such as logs, spool files, and temporary e-mail files. | -
|
- Application cache data. Such data are locally generated as a result of time-consuming I/O or calculation. The application must be able to regenerate or restore the data. The cached files can be deleted without loss of data. | -
|
- State information. Persistent data modified by programs as they run, e.g., databases, packaging system metadata, etc. | -
|
- Lock files. Files keeping track of resources currently in use. | -
|
- Log files. Various logs. | -
|
- Users’ mailboxes. | -
|
- Variable data from add-on packages that are stored in /opt/. |
-
|
- Information about the running system since last boot, e.g., currently logged-in users and running daemons. | -
|
- Spool for tasks waiting to be processed, e.g., print queues and outgoing mail queue. | -
|
- Deprecated location for users’ mailboxes. | -
|
- Temporary files to be preserved between reboots. | -
| Directory(目录) | +Description(描述) | +|
|---|---|---|
|
+ 主层次 的根,也是整个文件系统层次结构的根目录 | +|
|
+ 存放在单用户模式可用的必要命令二进制文件,对于所有用户而言,则是像cat,ls,cp等等的文件 | +|
|
+ 存放引导加载程序文件,例如kernels,initrd等 | +|
|
+ 存放必要的设备文件 | +|
|
+ 存放主机特定的系统范围内的配置文件。其实这里有个关于它名字本身意义上的的争议。在贝尔实验室的早期UNIX实施文档版本中,/etc表示是“其他目录”,因为从历史上看,这个目录是存放各种不属于其他目录的文件(然而,FSH(文件系统目录标准)限定 /ect是用于存放静态配置文件,这里不该存有二进制文件)。早期文档出版后,这个目录名又重新定义成不同的形式。近期的解释中包含着诸如“可编辑文本配置”或者“额外的工具箱”这样的重定义 | +|
|
+ 存储着新增包的配置文件 /opt/. |
+ |
|
+ 存放配置文件,比如目录,还有那些处理SGML(译者注:标准通用标记语言)的软件的配置文件 | +|
|
+ X Window系统的配置文件,版本号为11 | ++ |
|
+ 配置文件,比如目录,处理XML(译者注:可扩展标记语言)的软件的配置文件 | +|
|
+ 用户的主目录,包括保存的文件, 个人配置, 等等. | +|
|
+ /bin/ and /sbin/中的二进制文件必不可少的库文件 |
+ |
|
+ 备用格式的必要的库文件. 这样的目录视可选的,但如果他们存在的话, 他们还有一些要求. | +|
|
+ 可移动的多媒体(如CD-ROMs)的挂载点.(出现于 FHS-2.3) | +|
|
+ 临时挂载的文件系统 | +|
|
+ 自定义应用程序软件包 | +|
|
+ 以文件形式提供进程以及内核信息的虚拟文件系统,在Linux中,对应进程文件系统的挂载点 | +|
|
+ 根用户的主目录 | +|
|
+ 必要系统二进制文件, 比如, init, ip, mount. | +|
|
+ 系统提供的站点特定数据 | +|
|
+ 临时文件 (另见 /var/tmp). 通常在系统重启后删除 |
+ |
|
+ 二级层级 存储用户的只读数据; 包含(多)用户主要的公共文件以及应用程序 | +|
|
+ 非必要的命令二进制文件 (在单用户模式中不需要用到的); 用于所有用户. | +|
|
+ 标准的包含文件 | +|
|
+ 库文件,用于/usr/bin/ 和 /usr/sbin/.中的二进制文件 |
+ |
|
+ 备用格式库(可选的). | +|
|
+ 三级层次 用于本地数据, 具体到该主机上的.通常会有下一个子目录, 比如, bin/, lib/, share/. |
+ |
|
+ 非必要系统的二进制文件, 比如,用于不同网络服务的守护进程 | +|
|
+ 独立架构的 (共享) 数据. | +|
|
+ 源代码, 比如, 内核源文件以及与它相关的头文件 | +|
|
+ X Window系统,版本号:11,发行版本:6 | +|
|
+ 各式各样的文件,一些随着系统常规操作而持续改变的文件就放在这里,比如日志文件,脱机文件,还有临时的电子邮件文件 | +|
|
+ 应用程序缓存数据. 这些数据是根据I/O(输入/输出)的耗时结果或者是运算生成的.这些应用程序是可以重新生成或者恢复数据的.当没有数据丢失的时候,可以删除缓存文件. | +|
|
+ 状态信息.这些信息随着程序的运行而不停地改变,比如,数据库,系统元数据的打包等等 | +|
|
+ 锁文件。这些文件会持续监控正在使用的资源 | +|
|
+ 日志文件. 包含各种日志. | +|
|
+ 内含用户邮箱的相关文件 | +|
|
+ 来自附加包的各种数据都会存储在 /opt/. |
+ |
|
+ Information about the running system since last boot, e.g., currently logged-in users and running daemons. | +存放当前系统上次启动的相关信息, 例如, 当前登入的用户以及当前运行的daemons(守护进程). | +
|
+ 该spool主要用于存放将要被处理的任务, 比如, 打印队列以及邮件传出队列 | +|
|
+ 过时的位置,用于放置用户邮箱文件 | +|
|
+ 存放重启之前的临时接口 | +