/proc filesystem in Linux: a window into the kernel
Updated November 1, 2026
/proc is a virtual filesystem through which the kernel exposes processes and system state as files.
Common cases
cat /proc/cpuinfo # processor details
cat /proc/meminfo # memory state
cat /proc/loadavg # the load average
cat /proc/$$/status # the status of the current shell ($$ is its PID)Sample output
$ cat /proc/loadavg
3.77 2.20 1.17 5/594 7
$ head -3 /proc/meminfo
MemTotal: 12305676 kB
MemFree: 10260580 kB
MemAvailable: 11109724 kB
$ ls -l /proc/meminfo
-r--r--r-- 1 root root 0 Jul 26 03:49 /proc/meminfo
$ wc -c /proc/meminfo
1208 /proc/meminfoHow it works: there are no files on disk
/procis not on a disk: the kernel builds its contents fresh every time you read them. Every process has a directory/proc/<PID>, and files like/proc/meminfogive a live snapshot of the system right now. That is whycat /proc/loadavgshows fresh numbers every time. Theps,freeandtopcommands just read/procunder the hood and format it. To change kernel behaviour you use the neighbouring/proc/sys.
Common mistakes
Every file in /proc reports a size of zero. ls -l /proc/meminfo prints -r--r--r-- 1 root root 0, du -sh /proc/meminfo also says 0, and wc -c /proc/meminfo reads 1208 bytes at that same second. The kernel never fills the size field in the inode: the content is born at the moment you read it. A script that tests -s file before reading decides the file is empty and skips it.
/proc/self is the process doing the reading, not your shell. cat /proc/self/comm prints cat, because the kernel substitutes the PID of cat itself. Ask about your shell through /proc/$$: cat /proc/$$/comm gives bash. For the same reason /proc/self inside a pipeline points at the last stage of that pipeline, not at what you had in mind.
A process directory disappears together with the process. Store a PID, wait for it to finish, read it, and you get cat: /proc/11/status: No such file or directory. A live process owned by somebody else is not fully open either: cat /proc/9/environ answers Permission denied when the process is not yours, while cat /proc/9/status reads fine and shows the name and state.
Used in
You need this in the lesson The kernel via /proc. The theory is the chapter The Linux kernel at work.
See also
Kernel parameters: sysctl, Memory: free, Load average.
Try it
Open the sandbox: a real throwaway Linux terminal in your browser. Run the commands above by hand - the container is deleted when you leave.