Linux: The '/proc' Filesystem

March 18, 2025 1 min read 0 views

In Linux, everything is a file. Even processes.

Don't believe me? Open your terminal.

Exploring /proc

Go to /proc. You will see numbered directories.

Bash
cd /proc
ls
# 1  123  456 ...

These numbers are PIDs (Process IDs). Directory 1 is the init process (or systemd).

Hacking a Process

Let's say Python is running. Find its PID.

Code
pgrep python
# 1234

Go to /proc/1234. * cmdline: The command that started it. * environ: The environment variables (Secrets! 🤫). * fd: File descriptors (files it has opened).

Conclusion

If you want to know what a program is doing, don't guess. Look at /proc. It's the dashboard of the kernel.

Similar Posts