pidstat
A system monitoring command that displays per-process CPU, memory, I/O, and other resource statistics, updating in real-time at specified intervals.
pidstat is part of the sysstat package and shows resource consumption broken down by individual process or task. Unlike tools like top, it excels at tracking processes that have already exited and can log historical data to files for later analysis.
Common usage: pidstat 1 5 displays statistics every 1 second for 5 iterations. Use pidstat -u for CPU stats, pidstat -r for memory, pidstat -d for disk I/O, or pidstat -w for context switches. Add -p PID to monitor a specific process.
Example: pidstat -u 2 10 shows CPU usage of all processes every 2 seconds for 10 intervals, helping identify which processes are consuming CPU over time.