Glossary

/sys

Also known as: sysfs

/sys is a virtual filesystem ("sysfs") introduced in Linux 2.6 to expose the kernel's view of devices, drivers, buses, and other subsystems in a structured hierarchy. Where /proc grew organically and conflates process information with system tunables, /sys was designed from the start as a clean interface: each kobject in the kernel appears as a directory, and each attribute as a file.

Typical paths include /sys/class/net/eth0/ (network interfaces), /sys/class/block/sda/ (block devices), /sys/class/power_supply/BAT0/capacity (battery level), /sys/devices/ (the full device tree), and /sys/module/ (loaded kernel modules). Writing to the right file can change device parameters:

echo 50 > /sys/class/backlight/intel_backlight/brightness
echo mem > /sys/power/state       # suspend to RAM
cat /sys/class/net/eth0/address    # MAC address

Tools like udev use /sys to learn about newly plugged devices and react to them. Container runtimes selectively bind-mount parts of /sys into containers to expose a filtered view. Between /proc, /sys, and the device nodes under /dev, nearly every kernel-managed object on a Linux system is reachable through the filesystem—one of the design choices that keeps Linux feeling cohesive despite its size.

Related terms: /proc, Kernel, Device File

Discussed in:

Also defined in: Textbook of Linux