Debian Codegraph @

upstream/debian-unstable/man5/sysfs.5

raw
1 .\" Copyright 2017, Michael Kerrisk <[email protected]>
2 .\" Copyright, the authors of the Linux man-pages project
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .TH sysfs 5 2026-02-08 "Linux man-pages 6.18"
7 .SH NAME
8 sysfs \- a filesystem for exporting kernel objects
9 .SH DESCRIPTION
10 The
11 .B sysfs
12 filesystem is a pseudo-filesystem which provides an interface to
13 kernel data structures.
14 (More precisely, the files and directories in
15 .B sysfs
16 provide a view of the
17 .I kobject
18 structures defined internally within the kernel.)
19 The files under
20 .B sysfs
21 provide information about devices, kernel modules, filesystems,
22 and other kernel components.
23 .P
24 The
25 .B sysfs
26 filesystem is commonly mounted at
27 .IR /sys .
28 Typically, it is mounted automatically by the system,
29 but it can also be mounted manually using a command such as:
30 .P
31 .in +4n
32 .EX
33 mount \-t sysfs sysfs /sys
34 .EE
35 .in
36 .P
37 Many of the files in the
38 .B sysfs
39 filesystem are read-only,
40 but some files are writable, allowing kernel variables to be changed.
41 To avoid redundancy,
42 symbolic links are heavily used to connect entries across the filesystem tree.
43 .\"
44 .SS Files and directories
45 The following list describes some of the files and directories under the
46 .I /sys
47 hierarchy.
48 .TP
49 .I /sys/block
50 This subdirectory contains one symbolic link for each block device
51 that has been discovered on the system.
52 The symbolic links point to corresponding directories under
53 .IR /sys/devices .
54 .TP
55 .I /sys/bus
56 This directory contains one subdirectory for each of the bus types
57 in the kernel.
58 Inside each of these directories are two subdirectories:
59 .RS
60 .TP
61 .I devices
62 This subdirectory contains symbolic links to entries in
63 .I /sys/devices
64 that correspond to the devices discovered on this bus.
65 .TP
66 .I drivers
67 This subdirectory contains one subdirectory for each device driver
68 that is loaded on this bus.
69 .RE
70 .TP
71 .I /sys/class
72 This subdirectory contains a single layer of further subdirectories
73 for each of the device classes that have been registered on the system
74 (e.g., terminals, network devices, block devices, graphics devices,
75 sound devices, and so on).
76 Inside each of these subdirectories are symbolic links for each of the
77 devices in this class.
78 These symbolic links refer to entries in the
79 .I /sys/devices
80 directory.
81 .TP
82 .I /sys/class/net
83 Each of the entries in this directory is a symbolic link
84 representing one of the real or virtual networking devices
85 that are visible in the network namespace of the process
86 that is accessing the directory.
87 Each of these symbolic links refers to entries in the
88 .I /sys/devices
89 directory.
90 .TP
91 .I /sys/dev
92 This directory contains two subdirectories
93 .I block/
94 and
95 .IR char/ ,
96 corresponding, respectively,
97 to the block and character devices on the system.
98 Inside each of these subdirectories are symbolic links with names of the form
99 .IR major-ID : minor-ID ,
100 where the ID values correspond to the major and minor ID of a specific device.
101 Each symbolic link points to the
102 .B sysfs
103 directory for a device.
104 The symbolic links inside
105 .I /sys/dev
106 thus provide an easy way to look up the
107 .B sysfs
108 interface using the device IDs returned by a call to
109 .BR stat (2)
110 (or similar).
111 .IP
112 The following shell session shows an example from
113 .IR /sys/dev :
114 .IP
115 .in +4n
116 .EX
117 .RB $ " stat \-c \[dq]%t %T\[dq] /dev/null" ;
118 1 3
119 .RB $ " readlink /sys/dev/char/1\[rs]:3" ;
120 \&../../devices/virtual/mem/null
121 .RB $ " ls \-Fd /sys/devices/virtual/mem/null" ;
122 /sys/devices/virtual/mem/null/
123 .RB $ " ls \-d1 /sys/devices/virtual/mem/null/*" ;
124 /sys/devices/virtual/mem/null/dev
125 /sys/devices/virtual/mem/null/power/
126 /sys/devices/virtual/mem/null/subsystem@
127 /sys/devices/virtual/mem/null/uevent
128 .EE
129 .in
130 .TP
131 .I /sys/devices
132 This is a directory that contains a filesystem representation of
133 the kernel device tree,
134 which is a hierarchy of
135 .I device
136 structures within the kernel.
137 .TP
138 .I /sys/firmware
139 This subdirectory contains interfaces for viewing and manipulating
140 firmware-specific objects and attributes.
141 .TP
142 .I /sys/fs
143 This directory contains subdirectories for some filesystems.
144 A filesystem will have a subdirectory here only if it chose
145 to explicitly create the subdirectory.
146 .TP
147 .I /sys/fs/cgroup
148 This directory conventionally is used as a mount point for a
149 .BR tmpfs (5)
150 filesystem containing mount points for
151 .BR cgroups (7)
152 filesystems.
153 .TP
154 .I /sys/fs/smackfs
155 The directory contains configuration files for the SMACK LSM.
156 See the kernel source file
157 .IR Documentation/admin\-guide/LSM/Smack.rst .
158 .TP
159 .I /sys/hypervisor
160 [To be documented]
161 .TP
162 .I /sys/kernel
163 This subdirectory contains various files and subdirectories that provide
164 information about the running kernel.
165 .TP
166 .I /sys/kernel/cgroup/
167 For information about the files in this directory, see
168 .BR cgroups (7).
169 .TP
170 .I /sys/kernel/debug/tracing
171 Mount point for the
172 .I tracefs
173 filesystem used by the kernel's
174 .I ftrace
175 facility.
176 (For information on
177 .IR ftrace ,
178 see the kernel source file
179 .IR Documentation/trace/ftrace.rst .)
180 .TP
181 .I /sys/kernel/mm
182 This subdirectory contains various files and subdirectories that provide
183 information about the kernel's memory management subsystem.
184 .TP
185 .I /sys/kernel/mm/hugepages
186 This subdirectory contains one subdirectory for each of the
187 huge page sizes that the system supports.
188 The subdirectory name indicates the huge page size (e.g.,
189 .IR hugepages\-2048kB ).
190 Within each of these subdirectories is a set of files
191 that can be used to view and (in some cases) change settings
192 associated with that huge page size.
193 For further information, see the kernel source file
194 .IR Documentation/admin\-guide/mm/hugetlbpage.rst .
195 .TP
196 .I /sys/module
197 This subdirectory contains one subdirectory
198 for each module that is loaded into the kernel.
199 The name of each directory is the name of the module.
200 In each of the subdirectories, there may be following files:
201 .RS
202 .TP
203 .I coresize
204 [to be documented]
205 .TP
206 .I initsize
207 [to be documented]
208 .TP
209 .I initstate
210 [to be documented]
211 .TP
212 .I refcnt
213 [to be documented]
214 .TP
215 .I srcversion
216 [to be documented]
217 .TP
218 .I taint
219 [to be documented]
220 .TP
221 .I uevent
222 [to be documented]
223 .TP
224 .I version
225 [to be documented]
226 .RE
227 .IP
228 In each of the subdirectories, there may be following subdirectories:
229 .RS
230 .TP
231 .I drivers
232 [To be documented]
233 .TP
234 .I holders
235 [To be documented]
236 .TP
237 .I notes
238 [To be documented]
239 .TP
240 .I parameters
241 This directory contains one file for each module parameter,
242 with each file containing the value of the corresponding parameter.
243 Some of these files are writable, allowing the parameters to be changed.
244 .TP
245 .I sections
246 This subdirectories contains files with information about module sections.
247 This information is mainly used for debugging.
248 .P
249 [To be documented]
250 .RE
251 .TP
252 .I /sys/power
253 [To be documented]
254 .SH STANDARDS
255 Linux.
256 .SH HISTORY
257 Linux 2.6.0.
258 .SH NOTES
259 This manual page is incomplete, possibly inaccurate, and is the kind
260 of thing that needs to be updated very often.
261 .SH SEE ALSO
262 .BR proc (5),
263 .BR udev (7)
264 .P
265 P.\& Mochel (2005).
266 .IR "The sysfs filesystem" .
267 Proceedings of the 2005 Ottawa Linux Symposium.
268 .\" https://www.kernel.org/pub/linux/kernel/people/mochel/doc/papers/ols-2005/mochel.pdf
269 .P
270 The kernel source file
271 .I Documentation/filesystems/sysfs.rst
272 and various other files in
273 .I Documentation/ABI
274 and
275 .IR Documentation/*/sysfs.rst .