What are /proc, /sys and /dev used for?
Short answer: They are virtual (in-memory) file systems that the kernel uses to talk to user space. /proc shows information about processes (/proc/<pid>/...) and many kernel statistics and settings (/proc/meminfo, /proc/interrupts, /proc/sys/...). /sys (sysfs) shows the device model: every bus, device, driver and class, with one value per file. /dev contains device nodes (character and block devices) that programs open to talk to drivers.
/proc (procfs)
| Path | Contents |
|---|---|
/proc/<pid>/status, stat, maps, fd/, cmdline, environ |
process state, memory map, open files |
/proc/meminfo, /proc/cpuinfo, /proc/loadavg |
memory, CPUs, load |
/proc/interrupts, /proc/softirqs |
interrupt counts per CPU |
/proc/cmdline |
kernel command line |
/proc/sys/... (sysctl) |
tunable kernel parameters, e.g. /proc/sys/vm/swappiness, /proc/sys/net/ipv4/ip_forward |
/proc/device-tree |
the device tree the kernel booted with |
/sys (sysfs)
/sys/class/net/eth0/,/sys/class/leds/,/sys/class/thermal/: devices grouped by type./sys/bus/platform/devices/,/sys/bus/i2c/drivers/: buses, devices and drivers;bind/unbindfiles attach or detach a driver./sys/kernel/debug(debugfs, if mounted),/sys/fs/cgroup(cgroups),/sys/firmware/devicetree.- One value per file, in text, e.g.
cat /sys/class/thermal/thermal_zone0/temp.
/dev
- Character devices (
/dev/ttyS0,/dev/i2c-1,/dev/gpiochip0,/dev/null) and block devices (/dev/mmcblk0,/dev/sda). - Created automatically by devtmpfs and managed by udev/mdev, which set permissions and create friendly symlinks (
/dev/disk/by-uuid/...). - A device node is identified by its major/minor numbers, which select the driver and the device instance.
Role in system administration: almost every monitoring and configuration tool reads these files. ps, top and free read /proc; ip, lsblk, lsusb and udevadm use /sys; and sysctl -w writes /proc/sys. Scripts can do the same with cat and echo, which is very handy on minimal embedded systems with only BusyBox.
Rule of thumb for driver writers: process and legacy information in /proc, device attributes in /sys, data streams and control through a /dev node, and debugging-only information in debugfs.