Understanding /proc and /sys: Reading Kernel Information Directly

Earlier guides in this series have referenced files like /proc/cpuinfo, /proc/sys/vm/swappiness, and /sys/module/kvm_intel/parameters/nested without fully explaining what these paths actually are. The /proc and /sys filesystems aren’t regular files on…

Earlier guides in this series have referenced files like /proc/cpuinfo, /proc/sys/vm/swappiness, and /sys/module/kvm_intel/parameters/nested without fully explaining what these paths actually are. The /proc and /sys filesystems aren’t regular files on disk at all — they’re a live, kernel-generated window into system state, and understanding them directly reduces reliance on separate tools for information that’s genuinely available right there.

What Makes /proc and /sys Different from Regular Files

Both /proc and /sys are virtual filesystems, generated dynamically by the kernel in memory rather than existing as actual files on your storage device. Reading from them queries live kernel state directly; in many cases, writing to specific files within them changes kernel behavior immediately, without needing a reboot or a separate configuration tool.

/proc: Process and System Information

/proc primarily exposes information about running processes and overall system state, with each running process getting its own numbered subdirectory:

ls /proc/1234

This shows detailed information about the process with PID 1234, including its command line, memory maps, open file descriptors, and current status — genuinely the same underlying data source that ps and top (covered in the earlier process management guide) themselves read from.

Common /proc Files Worth Knowing

  • /proc/cpuinfo – detailed CPU information, referenced in the earlier nested virtualization guide for checking virtualization extension support
  • /proc/meminfo – detailed memory statistics, a lower-level source than the free command’s summarized output
  • /proc/sys/vm/swappiness – the swap tuning parameter covered in the earlier Linux swap guide, directly readable and writable here
  • /proc/net/bonding/bond0 – bonded network interface status, referenced in the earlier network bonding guide
  • /proc/loadavg – system load averages, the same source top and htop display in their headers

/sys: Hardware and Kernel Subsystem Information

/sys (sysfs) exposes information more specifically organized around the kernel’s internal device and driver model — hardware devices, kernel modules, and their configurable parameters:

ls /sys/class/net/

This lists network interfaces recognized by the kernel, useful for confirming exactly what network hardware Linux has detected, independent of any higher-level networking tool’s own interpretation.

Common /sys Paths Worth Knowing

  • /sys/module/kvm_intel/parameters/nested – the nested virtualization status checked in the earlier nested virtualization guide
  • /sys/class/thermal/ – temperature sensor readings, useful for hardware monitoring beyond what lm-sensors (referenced in the earlier fanless build guide) might show
  • /sys/block/ – block device information, including drive details relevant to the SSD and ZFS guides covered earlier
  • /sys/kernel/iommu_groups/ – IOMMU grouping information, directly referenced in both the GPU passthrough and NVMe passthrough guides for checking device isolation

Reading vs Writing: Understanding the Live Configuration Aspect

Many files within /proc/sys specifically are both readable and writable, meaning changes take effect immediately without a reboot — exactly the mechanism used in the earlier swappiness tuning example (sudo sysctl vm.swappiness=10), since sysctl is itself just a convenient interface for reading and writing these same underlying /proc/sys files.

Making Changes Persistent

Since /proc and /sys are regenerated fresh at every boot (they’re not stored on disk), direct writes to these files don’t survive a reboot on their own — this is why the earlier swappiness and nested virtualization guides specifically emphasized adding equivalent settings to /etc/sysctl.conf or a modprobe.d configuration file, ensuring the setting gets reapplied automatically after every boot rather than needing manual reconfiguration each time.

Using /proc for Quick Troubleshooting

Beyond referencing specific known paths, /proc and /sys are genuinely useful for general exploration when troubleshooting — checking /proc/[PID]/status for a specific misbehaving process’s detailed memory and state information beyond what ps/htop summarize, or browsing /sys/class/ to understand exactly what hardware categories the kernel has actually detected and organized.

A Word of Caution

While reading from /proc and /sys is always safe, writing to specific files can have immediate, sometimes significant effects on running system behavior — always understand specifically what a given write actually controls (ideally via kernel documentation or a trusted guide) before writing to an unfamiliar path, rather than experimenting blindly on a production system.