Sysfs

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Sysfs and the translation is 69% complete.
Other languages:

sysfs is a virtual filesystem (virtual means it takes up no disk space). It exports information about kernel devices, drivers, and other subsystems to user space and allows their configuration. It is generated by the kernel and always mounted at /sys.

Telepítés

Kernel

sysfs will usually be activated by default. The kernel option will only be visible if Configure standard kernel features (expert users) is enabled, and even then may not be able to be changed:

KERNEL A sysfs támogatás engedélyezése
File systems  --->
    Pseudo filesystems  --->
        -*- sysfs file system support

Használat

Use cat to read the information. For example, to output the charging level of a battery:

user $cat /sys/class/power_supply/BAT0/status

Get the device name by listing the /sys/class/net directory contents using ls -al or the tree command (provided by the app-text/tree package):

user $tree /sys/class/net
/sys/class/net/
├── enp2s14 -> ../../devices/pci0000:00/0000:00:1e.0/0000:02:0e.0/net/enp2s14
├── lo -> ../../devices/virtual/net/lo
├── sit0 -> ../../devices/virtual/net/sit0
└── wlp8s0 -> ../../devices/pci0000:00/0000:00:1c.0/0000:08:00.0/net/wlp8s0

sysfs can be used to set values at runtime. For example, the echo command can be used to enable system suspension:

root #echo mem > /sys/power/state

Az értékek rendszerindításkor történő beállításához hozzon létre egy local.d szkriptet.

További olvasnivaló a témában

It can be used to show and change system and process information.

  • tmpfs — a virtual filesystem created to store files in dynamic (volatile) memory.