1 .\" Copyright (c) 2017 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .TH SYSFS 5 2018-04-30 "Linux" "Linux Programmer's Manual"
27 sysfs \- a filesystem for exporting kernel objects
31 filesystem is a pseudo-filesystem which provides an interface to
32 kernel data structures.
33 (More precisely, the files and directories in
37 structures defined internally within the kernel.)
40 provide information about devices, kernel modules, filesystems,
41 and other kernel components.
45 filesystem is commonly mounted at
47 Typically, it is mounted automatically by the system,
48 but it can also be mounted manually using a command such as:
52 mount \-t sysfs sysfs /sys
56 Many of the files in the
58 filesystem are read-only,
59 but some files are writable, allowing kernel variables to be changed.
61 symbolic links are heavily used to connect entries across the filesystem tree.
63 .SS Files and directories
64 The following list describes some of the files and directories under the
69 This subdirectory contains one symbolic link for each block device
70 that has been discovered on the system.
71 The symbolic links point to corresponding directories under
75 This directory contains one subdirectory for each of the bus types
77 Inside each of these directories are two subdirectories:
81 This subdirectory contains symbolic links to entries in
83 that correspond to the devices discovered on this bus.
86 This subdirectory contains one subdirectory for each device driver
87 that is loaded on this bus.
91 This subdirectory contains a single layer of further subdirectories
92 for each of the device classes that have been registered on the system
93 (e.g., terminals, network devices, block devices, graphics devices,
94 sound devices, and so on).
95 Inside each of these subdirectories are symbolic links for each of the
96 devices in this class.
97 These symbolic links refer to entries in the
102 Each of the entries in this directory is a symbolic link
103 representing one of the real or virtual networking devices
104 that are visible in the network namespace of the process
105 that is accessing the directory.
106 Each of these symbolic links refers to entries in the
111 This directory contains two subdirectories
115 corresponding, respectively,
116 to the block and character devices on the system.
117 Inside each of these subdirectories are symbolic links with names of the form
118 .IR major-ID : minor-ID ,
119 where the ID values correspond to the major and minor ID of a specific device.
120 Each symbolic link points to the
122 directory for a device.
123 The symbolic links inside
125 thus provide an easy way to look up the
127 interface using the device IDs returned by a call to
131 The following shell session shows an example from
136 $ \fBstat \-c "%t %T" /dev/null\fP
138 $ \fBreadlink /sys/dev/char/1\\:3\fP
139 \&../../devices/virtual/mem/null
140 $ \fBls \-Fd /sys/devices/virtual/mem/null\fP
141 /sys/devices/virtual/mem/null/
142 $ \fBls \-d1 /sys/devices/virtual/mem/null/*\fP
143 /sys/devices/virtual/mem/null/dev
144 /sys/devices/virtual/mem/null/power/
145 /sys/devices/virtual/mem/null/subsystem@
146 /sys/devices/virtual/mem/null/uevent
151 This is a directory that contains a filesystem representation of
152 the kernel device tree,
153 which is a hierarchy of
155 structures within the kernel.
158 This subdirectory contains interfaces for viewing and manipulating
159 firmware-specific objects and attributes.
162 This directory contains subdirectories for some filesystems.
163 A filesystem will have a subdirectory here only if it chose
164 to explicitly create the subdirectory.
167 This directory conventionally is used as a mount point for a
169 filesystem containing mount points for
174 The directory contains configuration files for the SMACK LSM.
175 See the kernel source file
176 .IR Documentation/admin-guide/LSM/Smack.rst .
182 This subdirectory contains various files and subdirectories that provide
183 information about the running kernel.
185 .IR /sys/kernel/cgroup/
186 For information about the files in this directory, see
189 .IR /sys/kernel/debug/tracing
192 filesystem used by the kernel's
197 see the kernel source file
198 .IR Documentation/trace/ftrace.txt .)
201 This subdirectory contains various files and subdirectories that provide
202 information about the kernel's memory management subsystem.
204 .IR /sys/kernel/mm/hugepages
205 This subdirectory contains one subdirectory for each of the
206 huge page sizes that the system supports.
207 The subdirectory name indicates the huge page size (e.g.,
208 .IR hugepages-2048kB ).
209 Within each of these subdirectories is a set of files
210 that can be used to view and (in some cases) change settings
211 associated with that huge page size.
212 For further information, see the kernel source file
213 .IR Documentation/admin-guide/mm/hugetlbpage.rst .
216 This subdirectory contains one subdirectory
217 for each module that is loaded into the kernel.
218 The name of each directory is the name of the module.
219 In each of the subdirectories, there may be following files:
247 In each of the subdirectories, there may be following subdirectories:
260 This directory contains one file for each module parameter,
261 with each file containing the value of the corresponding parameter.
262 Some of these files are writable, allowing the
265 This subdirectories contains files with information about module sections.
266 This information is mainly used for debugging.
277 filesystem first appeared in Linux 2.6.0.
281 filesystem is Linux-specific.
283 This manual page is incomplete, possibly inaccurate, and is the kind
284 of thing that needs to be updated very often.
290 .IR "The sysfs filesystem" .
291 Proceedings of the 2005 Ottawa Linux Symposium.
292 .\" https://www.kernel.org/pub/linux/kernel/people/mochel/doc/papers/ols-2005/mochel.pdf
294 The kernel source file
295 .I Documentation/filesystems/sysfs.txt
296 and various other files in
297 .IR Documentation/ABI
299 .IR Documentation/*/sysfs.txt