skip to content
Ivan's wiki
Site Tools
Search
Tools
Show pagesource
Backlinks
Recent Changes
Media Manager
Sitemap
>
Recent Changes
Media Manager
Sitemap
path-proc
This page is read only. You can view the source, but not change it.
# /proc **/proc** is a virtual filesystem (procfs) with no backing storage on disk. Every file and directory in it is generated on the fly by the kernel when read. It is the primary interface for reading kernel state and per-process information from userspace, using ordinary `open`, `read`, and `write` calls on what appear to be files. Each running process gets a directory named after its PID: ``` /proc/1234/ cmdline command line as a null-delimited string environ environment variables as null-delimited strings exe symlink to the executable on disk fd/ symlinks to each open file descriptor maps virtual memory map: address ranges, permissions, mappings status human-readable process state: name, PID, PPID, memory usage stat machine-readable version of status, used by ps and top cwd symlink to the current working directory ``` System-wide information lives at the top level: ``` /proc/cpuinfo per-core details: model, cache sizes, feature flags /proc/meminfo memory usage: total, free, buffers, cached, swap /proc/uptime seconds since boot and idle time /proc/loadavg 1-, 5-, 15-minute load averages and runqueue depth /proc/mounts currently mounted filesystems (same data as /etc/mtab) /proc/net/ network interface statistics, routing table, sockets /proc/sys/ kernel tunables; many are writable ``` `/proc/sys/` is the most interactive part: writing a value to a file changes a kernel parameter live. `sysctl` is a wrapper around this interface. ```sh # read the current value of a tunable cat /proc/sys/net/ipv4/ip_forward # enable IP forwarding immediately (does not persist across reboot) echo 1 > /proc/sys/net/ipv4/ip_forward # the sysctl wrapper does the same thing sysctl net.ipv4.ip_forward=1 ```
Page Tools
Show pagesource
Backlinks
Back to top