Show CPU core usage for parent process and its child processes

cpucpu usageperformanceprocess

Is it possible to display CPU core usage just for a single process and its child processes on Linux?

Best Answer

Do you mean all processes started by some process (have the same parent PID)?

If you have pgrep you can filter all the processes with the same parent ID:

top -p $(pgrep -P 2069 -d,)

If not you can filter all process ids through awk and use them with top -p:

top -p $(ps -eo pid,ppid |awk '($2==2069){printf "%s%s",delim,$1; delim=","}')

Change $2==2069 with the actual parent pid you want to track.

Related Question