FHS standard Linux directory structure

Because Linux developers too much, if everyone uses their own directory configuration, it will probably bring a lot of management problems. So, then there Filesystem Hierarchy Standard (FHS, filesystem hierarchy standard) standard baked, and most versions of Linux file organization using this form, similar to a file directory in the Windows operating system c drive, FHS uses a tree structure organize files.

According to FHS official documents indicated that its main purpose is to allow users to understand what data is usually placed under the directory. In other words, FHS focus is under the specifications of each particular directory what data should be placed.

FHS based file system used frequently tamper with it or not and whether the user, and the directory is defined into four interactions form:

  Shareable : You can share directories using other systems to mount, it includes the executable file to the user's e-mail and other data, to be able to share directories on the network with other hosts to mount.

  Not sharing : device file to run your machine above or socket and other related documents and procedures, as relevant only their own machine, it is not suitable to share with other hosts.

  Unchanged : Some data is not constantly changing, just as the system version changes. Such as libraries, documentation, system administrators managed hosting services configuration files.

  You can change : constantly changing data, such as login files, user files.

 

Root directory(/)

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, system repair and other related operations.

Therefore, the FHS recommendations: root directory (/) where the partition should be as small as possible, and the software applications installed preferably not on the same partition with the root directory, keep the root directory of the smaller the better . So not only better performance, the root directory where the file system is also less prone to problems.

 

Perform file directory (/ bin)

There are many systems perform file directory placement, but the / bin special. Since  / bin command is placed in the single-user maintenance mode it can be operated . In / bin following command can be used with the root account general, there are common commands cat, chmod, chown, date, mv, mkdir, cp, bash like.

 

Boot file directory (/ boot)

The main directory file placement opportunities open to use, including the  Linux kernel file and boot the boot menu and the required profile and so on.

 

Drive device directory (/ dev)

On Linux systems, any device and interface device are in the form of files in this directory among . You just by accessing a file in this directory, it means access to a device. There are more important file / dev / null, / dev / zero, / dev / tty and so on.

 

Profile directory (/ etc)

The main system configuration files are placed almost in the directory, for example, account password file officers, starting various services such as file. In general, the various file attributes of this directory is that it gives the user access to the general, but only root has the right to modify. There /etc/init.d,/etc/inittab,/etc/sysconfig more important documents and so on.

 

User home folder (/ home)

This is the default user's home folder (home directory). When you create a normal user account, the default user home folder will be standardized to be here. ~ Represents the current user's home folder .

 

System library (/ lib)

Library system is very large, and / lib library is placed in the boot will be used, as well as in the library / bin or / sbin following command will call it.

* You can imagine the library as a "plug-in", some of these commands must have "plug-in" was intended to complete the implementation of the program smoothly.

 

Suspend media device region (/ media)

media 是“媒体”的英文,顾名思义,这个 /media 下面放置的就是可删除的设备。包括软盘、光盘、DVD等设备都暂时挂载于此。常见的文件名有 /media/floppy,/media/cdrom 等。

 

额外设备暂挂区(/mnt)

如果你想要暂时挂载某些额外的设备,一般建议你可以放置到这个目录中。在比较早的时候,这个目录的用途与 /media 相同。只是有了 /media 之后,这个目录就被用来暂时挂载用了。

 

第三方软件安装目录(/opt)

这个目录是用于安装第三方应用程序的,可以由用户自己指定安装位置。当需要卸载第三方应用程序时,可以直接删除安装目录,而不影响系统其它任何设置。

 

管理员主文件夹(/root)

系统管理员(root)的主文件夹。之所以放在这里,是因为如果进入单用户维护模式而仅挂载根目录时,该目录就能够拥有root的主文件夹,所以我们会希望root的主文件夹与根目录放置在同一个分区中。

 

重要系统执行文件(/sbin)

Linux 有非常多的命令是来设置系统环境的,这些命令只有 root 才能够利用来“设置”系统,其他用户最多只能用来“查询”而已。放在 /sbin 下面的为开机过程中所需的,里面包括了开机、修复、还原系统所需要的命令。

 

服务数据存放目录(/srv)

srv 可以视为“service”的缩写,是一些网络服务启动之后,这些服务所需要取用的数据目录。常见的服务例如 WWW、FTP 等。举例来说,WWW 服务需要的网页数据就可以放置在 /srv/www/ 里。

 

临时文件存放目录(/tmp)

这是让一般用户或者是正在执行的程序暂时放置文件的地方。这个目录是任何人都能够访问,所以你需要定期清理一下。当然,重要数据不可放置在此目录,因为系统会不定期将 /tmp 目录下的数据全部删除

 

丢失内容修复目录(/lost+found)

这个目录是使用标准的 ext2/ext3 文件系统格式才会产生的一个目录,目的相当于文件系统发生错误时,将一些丢失的片段放置到这个目录下。这个目录通常会在分区的最顶层存在。

 

虚拟文件系统目录(/proc)

这个目录本身是一个虚拟文件系统(virtual filesystem)。它放置的数据都是在内存当中,例如系统内核、进程、外部设备以及网络状态等。因为这个目录下的数据都是在内存当中的,所以本身并不占任何硬盘空间

 

虚拟文件系统目录(/sys)

这个目录其实跟 /proc 非常类似,也是一个虚拟的文件系统,主要也是记录与内核相关的信息。包括目前已加载的内核模块与内核检测到的硬件设备信息等。这个目录同样不占硬盘容量。

 

系统软件资源目录(/usr)

很多小白都会误以为 /usr 是 user 的缩写,其实 usr 是 Unix Software Resource 的缩写,也就是 “UNIX 操作系统软件资源” 所放置的目录,而不是用户的数据,这点需要注意。

FHS 建议所有软件开发者应该将他们的数据合理地分别放置到这个目录下的子目录,而不要自行新建该软件的独立目录。

 

  /usr/bin/:绝大部分的用户可使用命令都放在这里

  /usr/include/:C/C++等程序语言的头文件(header)与包含文件(include)放置处

  /usr/lib/:包含各应用软件的函数库、目标文件以及一些不被一般用户惯用的执行文件或脚本

  /usr/local/:系统管理员在本机自行安装下载的软件建议安装到此目录

  /usr/sbin/:非系统正常运行所需的系统命令

  /usr/share/:放置共享文件的地方

  /usr/src/:一般源码建议放置到这里

 

常态可变动文件目录(/var)

该目录主要针对常态性可变动文件,包括缓存(cache)、登录文件(log file)以及某些软件运行所产生的文件,包括程序文件(lock file、run file),或者例如MySQL数据库的文件等。

如果 /usr 是安装时会占用较大硬盘容量的目录,那么 /var 就是在系统运行后才会渐渐占用硬盘容量的目录。

 

  /var/cache/:应用程序本身运行过程中会产生的一些暂存文件

  /var/lib/:程序本身执行的过程中,需要使用到的数据文件放置的目录

  /var/lock/:目录下的文件资源一次只能被一个应用程序所使用

  /var/log/:放置登录文件的目录

  /var/mail/:放置个人电子邮件信箱的目录

  /var/run/:某些程序或服务启动后的PID目录

  /var/spool/:放置排队等待其他应用程程序使用的数据

 

参考自其他博客:https://www.cnblogs.com/woider/p/6618295.html

Guess you like

Origin www.cnblogs.com/opsprobe/p/11521059.html