Drill: Explore the /proc Filesystem for a Process¶
Goal¶
Read /proc/PID entries to inspect a running process's command line, environment, file descriptors, memory maps, and status.
Setup¶
- Linux system with procfs mounted at /proc
- A running process to inspect (use $$ for your current shell)
Commands¶
Read the command line of a process:
View the process environment variables:
Check process status (state, memory, threads):
List open file descriptors:
Count open file descriptors:
View memory mappings:
Check resource limits:
Read the process's current working directory:
Read the actual binary being executed:
What to Look For¶
statusshows VmRSS (actual memory usage) and Threads countfd/symlinks show where each file descriptor points (files, sockets, pipes)environreveals the exact environment the process sees, useful for debugging configlimitsshows ulimits in effect, Max open files is a common bottleneck
Common Mistakes¶
- Forgetting to translate null bytes in cmdline and environ (fields are null-delimited)
- Trying to read /proc entries of another user's process without root
- Confusing VmSize (virtual) with VmRSS (resident) memory in status
- Not realizing /proc entries disappear when the process exits
Cleanup¶
No cleanup needed. /proc is a virtual read-only filesystem.