Procfs is a special filesystem that enumerates kernel data structures as files. This filesystem serves as a debugging resource for kernel programmers, since it allows users to view the state of data structures through the virtual file interface. Procfs is mounted to the /proc directory (mount point) of rootfs.
Data in procfs files is not persistent, and is always constructed on the run; each file is an interface through which users can trigger associated operations. For instance, a read operation on a proc file invokes the associated read callback function bound to the file entry, and that function is implemented to populate the user buffer with appropriate data.
The number of files enumerated depends on the configuration and architecture for which the kernel was built. Following is a list of a few important files with useful data enumerated under /proc:
File name | Description |
/proc/cpuinfo | Provides low-level cpu details such as vendor, model, clock speed, cache size, number of siblings, cores, CPU flags, and bogomips. |
/proc/meminfo | Provides a summarized view of physical memory state. |
/proc/ioports | Provides details on current usage of port I/O address space supported by the x86 class of machines. This file is not present on other architectures. |
/proc/iomem | Shows a detailed layout describing current usage of memory address space. |
/proc/interrupts | Shows a view of the IRQ descriptor table that contains details of IRQ lines and interrupt handlers bound to each. |
/proc/slabinfo | Shows a detailed listing of slab caches and their current state. |
/proc/buddyinfo | Shows the current state of buddy lists managed by the buddy system. |
/proc/vmstat | Shows virtual memory management statistics. |
/proc/zoneinfo | Shows per-node memory zone statistics. |
/proc/cmdline | Shows boot arguments passed to the kernel. |
/proc/timer_list | Shows a list of active pending timers, with details of clock source. |
/proc/timer_stats | Provides detailed statistics on active timers, used for tracking timer usage and debugging. |
/proc/filesystems | Presents a list of filesystem services currently active. |
/proc/mounts | Shows currently mounted devices with their mountpoints. |
/proc/partitions | Presents details of current storage partitions detected with associated /dev file enumerations. |
/proc/swaps | Lists out active swap partitions with status details. |
/proc/modules | Lists out names and status of kernel modules currently deployed. |
/proc/uptime | Shows length of time kernel has been running since boot and spent in idle mode. |
/proc/kmsg | Shows contents of kernel's message log buffer. |
/proc/kallsyms | Presents kernel symbol table. |
/proc/devices | Presents a list of registered block and character devices with their major numbers. |
/proc/misc | Presents a list of devices registered through the misc interface with their misc identifiers. |
/proc/stat | Presents system statistics. |
/proc/net | Directory that contains various network stack-related pseudo files. |
/proc/sysvipc | Subdirectory containing pseudo files that show the status of System V IPC objects, message queues, semaphores, and shared memory. |
/proc also lists out a number of subdirectories that provide a detailed view of elements in process PCB or task structure. These folders are named by the PID of the process that they represent. Following is a list of important files that present process-related information:
File name | Description |
/proc/pid/cmdline | Command-line name of the process. |
/proc/pid/exe | A symbolic link to the executable file. |
/proc/pid/environ | Lists out environmental variables accessible to the process. |
/proc/pid/cwd | A symbolic link to the current working directory of the process. |
/proc/pid/mem | A binary image that shows the virtual memory of the process. |
/proc/pid/maps | Lists out virtual memory mappings for the process. |
/proc/pid/fdinfo | A directory that lists out open file descriptors' current status and flags. |
/proc/pid/fd | Directory that contains symlink to open file descriptors. |
/proc/pid/status | Lists out current status of the process, including its memory usage. |
/proc/pid/sched | Lists out scheduling statistics. |
/proc/pid/cpuset | Lists out the cpu affinity mask for this process. |
/proc/pid/cgroup | Shows cgroup details for the process. |
/proc/pid/stack | Shows backtrace of the process-owned kernel stack. |
/proc/pid/smaps | Shows memory consumed for each mapping into its address space. |
/proc/pid/pagemap | Shows the physical mapping status for each virtual page of the process. |
/proc/pid/syscall | Exposes the system call number and arguments for the system call currently being executed by the process. |
/proc/pid/task | Directory containing child process/thread details. |
All of the files we listed so far are read-only; procfs also contains a branch /proc/sys that holds read-write files, which are referred to as kernel parameters. Files under /proc/sys are further classified as per the subsystems to which they apply. Listing out all those files is out of scope.