EKsumic's Blog

let today = new Beginning();

Click the left button to use the catalog.

OR

Linux新手入门第十一天——sys目录的功能基本认知

关于/sys,首先得谈到sysfs,

sysfs文件系统总是被挂载在/sys 挂载点上,

sysfs是Linux内核设计中较新的一种虚拟的基于内存的文件系统,

它与proc的区别在于,sys是新的,proc是旧的,

 

或者换句话说,

sys是设计出来用来改进proc的这种访问方式的。

 

/sys是一个基于内存的文件系统,和/proc差不多。

/sys将各种内核子系统,硬件设备和相关设备驱动程序的信息,从内核的设备模型导出到用户空间,进而提供一组虚拟文件。而且你还可以对这些文件进行配置。

 

Q:既然/sys比/proc好用,那为什么没有把/proc剔除掉?

A:这个是历史遗留问题,/sys也许取代了/proc的绝大部分功能,但由于习惯,或小部分功能还是使用/proc来处理。

 

 

/sys/devices

该目录下是全局设备结构体系,包含所有被发现的注册在各种总线上的各种物理设备

/sys/dev

该目录下存放主次设备号文件

/sys/class

该目录下包含所有注册在kernel里面的设备类型

/sys/block

该目录下的所有子目录代表着系统中当前被发现的所有块设备

/sys/bus

该目录下的每个子目录都是kernel支持并且已经注册了的总线类型

/sys/fs

【空】

按照设计,该目录使用来描述系统中所有的文件系统,包括文件系统本身和按照文件系统分类存放的已挂载点。

/sys/kernel

【自己看】

/sys/firmware

这里是系统加载固件机制的对用户空间的接口

/sys/module

该目录下有系统中所有的模块信息

/sys/power

该目录是系统中的电源选项

 

其实一圈看下来,你可能会觉得这东西更像你熟悉的BIOS,先这么理解吧,以后用到了再说。

 

 

【目录】Linux新手入门——从理论到实战

 

参考文档:

[1] procfs和sysfs有什么区别?

[2] /sys 和 /dev的区别

[3] Linux下/sys目录介绍

This article was last edited at 2023-04-21 22:43:53

Leslie

Highly descriptive post, I loved that a lot. Will thede bee a part 2?

reply

2023-04-26 08:01:44

Krissy Lynn teaser 5

Amazing blog! Do you have anyy tps and hins foor asliring writers? I'm planning too staft myy own sitye soon but I'm a littrle ost on everything. Would yyou recommendd startying witfh a free platform liie Wordpress orr go forr a paqid option? There aare so many options outt there that I'm totaslly confused .. Anyy suggestions? Bless you!

reply

2023-04-30 15:39:38

mujeres desnudas japonesas

naturally lke you web site but yoou neewd tto test tthe spelling on quiute a few of your posts. A number off them arre rife with spelling problems and I tto finnd it very troublesome tto tesll tthe reality nevertheless I will definitely cime bazck again.

reply

2023-09-02 21:43:20

* *