PROCFS
Platform Ops Glossary /proc
Fundamentals, Kernel & Shell · Term #90

/proc

A virtual filesystem exposing live kernel and process information as readable files.

Category
Fundamentals, Kernel & Shell
Complexity
Intermediate
Glossary Entry
#90 of 190
/syssysctlLinux Kernel/syssysctlLinux Kernel
What Is It

The Short Answer

/proc looks and behaves like a normal directory tree, but nothing under it is stored on disk — every file is generated by the kernel at the exact moment you read it, reflecting live system state. It's the primary way user-space tools like ps, top, and free get their information; they're just reading /proc files and formatting the output.

Every running process gets its own numbered subdirectory (/proc/1234/) containing that process's memory maps, open file descriptors, command-line arguments, and current status — readable by anyone with the right permissions.

How It Works

Under The Hood

System-wide files sit directly under /proc: /proc/cpuinfo, /proc/meminfo, /proc/loadavg. Per-process files sit under /proc/<pid>/, and the special path /proc/self/ always refers to whichever process is currently reading it — useful in scripts that need their own PID without calling $$.

Because these files are generated on read rather than stored, tools like ls -l or du report meaningless sizes (often 0 bytes) for most of them — the content only exists at the moment of the read() syscall.

In Practice

Example Commands

read live kernel state
cat /proc/meminfo | head -5
cat /proc/1234/status
# detailed state for a specific PID
ls /proc/1234/fd/
# every file descriptor that process currently has open
Watch Out For

Common Mistakes

⚠️Trying to back up or tar a directory that includes /proc — it isn't real data and will hang or produce garbage; always exclude it explicitly.
⚠️Reading a /proc/<pid>/ file just as that process exits — the directory can disappear mid-read, causing a "No such file or directory" error that looks like a bug but isn't.
VA
Vishal Abhinav
Platform Ops Engineer · Linux & Unix Glossary