1 .\" Copyright (c) 2017 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .TH SYSFS 5 2021-03-22 "Linux" "Linux Programmer's Manual"
7 sysfs \- a filesystem for exporting kernel objects
11 filesystem is a pseudo-filesystem which provides an interface to
12 kernel data structures.
13 (More precisely, the files and directories in
17 structures defined internally within the kernel.)
20 provide information about devices, kernel modules, filesystems,
21 and other kernel components.
25 filesystem is commonly mounted at
27 Typically, it is mounted automatically by the system,
28 but it can also be mounted manually using a command such as:
32 mount \-t sysfs sysfs /sys
36 Many of the files in the
38 filesystem are read-only,
39 but some files are writable, allowing kernel variables to be changed.
41 symbolic links are heavily used to connect entries across the filesystem tree.
43 .SS Files and directories
44 The following list describes some of the files and directories under the
49 This subdirectory contains one symbolic link for each block device
50 that has been discovered on the system.
51 The symbolic links point to corresponding directories under
55 This directory contains one subdirectory for each of the bus types
57 Inside each of these directories are two subdirectories:
61 This subdirectory contains symbolic links to entries in
63 that correspond to the devices discovered on this bus.
66 This subdirectory contains one subdirectory for each device driver
67 that is loaded on this bus.
71 This subdirectory contains a single layer of further subdirectories
72 for each of the device classes that have been registered on the system
73 (e.g., terminals, network devices, block devices, graphics devices,
74 sound devices, and so on).
75 Inside each of these subdirectories are symbolic links for each of the
76 devices in this class.
77 These symbolic links refer to entries in the
82 Each of the entries in this directory is a symbolic link
83 representing one of the real or virtual networking devices
84 that are visible in the network namespace of the process
85 that is accessing the directory.
86 Each of these symbolic links refers to entries in the
91 This directory contains two subdirectories
95 corresponding, respectively,
96 to the block and character devices on the system.
97 Inside each of these subdirectories are symbolic links with names of the form
98 .IR major-ID : minor-ID ,
99 where the ID values correspond to the major and minor ID of a specific device.
100 Each symbolic link points to the
102 directory for a device.
103 The symbolic links inside
105 thus provide an easy way to look up the
107 interface using the device IDs returned by a call to
111 The following shell session shows an example from
116 $ \fBstat \-c "%t %T" /dev/null\fP
118 $ \fBreadlink /sys/dev/char/1\e:3\fP
119 \&../../devices/virtual/mem/null
120 $ \fBls \-Fd /sys/devices/virtual/mem/null\fP
121 /sys/devices/virtual/mem/null/
122 $ \fBls \-d1 /sys/devices/virtual/mem/null/*\fP
123 /sys/devices/virtual/mem/null/dev
124 /sys/devices/virtual/mem/null/power/
125 /sys/devices/virtual/mem/null/subsystem@
126 /sys/devices/virtual/mem/null/uevent
131 This is a directory that contains a filesystem representation of
132 the kernel device tree,
133 which is a hierarchy of
135 structures within the kernel.
138 This subdirectory contains interfaces for viewing and manipulating
139 firmware-specific objects and attributes.
142 This directory contains subdirectories for some filesystems.
143 A filesystem will have a subdirectory here only if it chose
144 to explicitly create the subdirectory.
147 This directory conventionally is used as a mount point for a
149 filesystem containing mount points for
154 The directory contains configuration files for the SMACK LSM.
155 See the kernel source file
156 .IR Documentation/admin\-guide/LSM/Smack.rst .
162 This subdirectory contains various files and subdirectories that provide
163 information about the running kernel.
165 .IR /sys/kernel/cgroup/
166 For information about the files in this directory, see
169 .IR /sys/kernel/debug/tracing
172 filesystem used by the kernel's
177 see the kernel source file
178 .IR Documentation/trace/ftrace.txt .)
181 This subdirectory contains various files and subdirectories that provide
182 information about the kernel's memory management subsystem.
184 .IR /sys/kernel/mm/hugepages
185 This subdirectory contains one subdirectory for each of the
186 huge page sizes that the system supports.
187 The subdirectory name indicates the huge page size (e.g.,
188 .IR hugepages\-2048kB ).
189 Within each of these subdirectories is a set of files
190 that can be used to view and (in some cases) change settings
191 associated with that huge page size.
192 For further information, see the kernel source file
193 .IR Documentation/admin\-guide/mm/hugetlbpage.rst .
196 This subdirectory contains one subdirectory
197 for each module that is loaded into the kernel.
198 The name of each directory is the name of the module.
199 In each of the subdirectories, there may be following files:
227 In each of the subdirectories, there may be following subdirectories:
240 This directory contains one file for each module parameter,
241 with each file containing the value of the corresponding parameter.
242 Some of these files are writable, allowing the
245 This subdirectories contains files with information about module sections.
246 This information is mainly used for debugging.
257 filesystem first appeared in Linux 2.6.0.
261 filesystem is Linux-specific.
263 This manual page is incomplete, possibly inaccurate, and is the kind
264 of thing that needs to be updated very often.
270 .IR "The sysfs filesystem" .
271 Proceedings of the 2005 Ottawa Linux Symposium.
272 .\" https://www.kernel.org/pub/linux/kernel/people/mochel/doc/papers/ols-2005/mochel.pdf
274 The kernel source file
275 .I Documentation/filesystems/sysfs.txt
276 and various other files in
277 .IR Documentation/ABI
279 .IR Documentation/*/sysfs.txt