DBS:- Directory /proc on Linux.

Everything on the Linux/UNIX system is considered to be a file. With this assumption, Does that mean processes are also files? Yes, they are. You can find everything about processes in the /proc directory on Linux/Unix system.

In fact, there is a complete directory dedicated to a process in /proc. If we "ls" to the /proc, we are presented with a list of numerical directories. The number here is nothing but the Process ID's. If we ls into those, we can find everything about a process. Like a link to the executable of this process, the last CPU used, memory held, process status etc. The base directory of the proc (/proc) holds information about Kernel data.

Most of the files in the /proc are read-only, considering the sensitive information it holds. Moving one process directory to another process directory can be disastrous for the process. Whereas some files are writable. These are mostly the kernel data files. Writing in these files might tweak some behavior of the kernel or trigger some actions.

The interesting fact about /proc is that It's a pseudo directory. An Illusion created by Kernel. The /proc does not persist anywhere on the disk. The reason is pretty intuitive. Processes are created at runtime. When the system is powered off, No process is running.

This blog is part of the blog series Developer’s bedtime stories. Please check my other articles with a prefix to the article name as DBS, short for Developer’s Bedtime Stories.

A wizard with no Magic.