I need to show all processes under a certain program. If I do top -p PID
I will only get one program.
I want to type top -p 381 extra_args
to get
PID USER PR NI VIRT RES %CPU %MEM TIME+ S COMMAND
381 root 20 0 8715.7m 12.5m 0.0 0.3 0:48.42 S `- /usr/bin/program
10034 root 20 0 8476.3m 2.3m 0.0 0.1 0:00.03 S `- -/usr/bin/sh
10036 root 20 0 8488.3m 2.2m 0.0 0.1 0:00.01 S `- /usr/bin/sh ./login.sh
10037 root 20 0 3.9m 3.1m 0.0 0.1 0:00.54 S `- /usr/bin/bash --login +h
19995 root 20 0 8506.3m 2.4m 0.0 0.1 0:00.01 S `- -/usr/bin/sh
19997 root 20 0 8512.3m 2.2m 0.0 0.1 0:00.01 S `- /usr/bin/sh ./login.sh
19998 root 20 0 3.9m 3.1m 0.0 0.1 0:00.89 S `- /usr/bin/bash --login +h
30644 root 20 0 2.8m 2.1m 0.0 0.1 0:00.03 S `- make -j8
30647 root 20 0 2.8m 2.0m 0.0 0.1 0:00.01 S `- make all-recursive
30648 root 20 0 2.2m 1.4m 0.0 0.0 0:00.00 S `- /bin/sh -c fail=; \ if (target_option=k; case ${targe+
30661 root 20 0 2.8m 2.1m 0.0 0.1 0:00.06 S `- make all-am
30671 root 20 0 2.4m 1.6m 0.0 0.0 0:00.04 S `- /bin/sh ./libtool --silent --tag=CC --mode=co+
30808 root 20 0 3.9m 0.3m 0.0 0.0 0:00.00 S `- gcc -DHAVE_CONFIG_H -I. -I.. -I./include +
30816 root 20 0 132.3m 117.7m 98.7 3.1 0:43.18 R `- /usr/libexec/gcc/aarch64-unknown-linu+
30675 root 20 0 2.4m 1.6m 0.0 0.0 0:00.04 S `- /bin/sh ./libtool --silent --tag=CC --mode=co+
31230 root 20 0 3.9m 0.3m 0.0 0.0 0:00.00 S `- gcc -DHAVE_CONFIG_H -I. -I.. -I./include +
31231 root 20 0 88.3m 76.6m 99.4 2.0 0:20.08 R `- /usr/libexec/gcc/aarch64-unknown-linu+
31074 root 20 0 2.4m 1.6m 0.0 0.0 0:00.05 S `- /bin/sh ./libtool --silent --tag=CC --mode=co+
31274 root 20 0 3.9m 0.3m 0.0 0.0 0:00.00 S `- gcc -DHAVE_CONFIG_H -I. -I.. -I./include
Instead of top -p 381
which gives
PID USER PR NI VIRT RES %CPU %MEM TIME+ S COMMAND
381 root 20 0 8715.7m 12.5m 0.0 0.3 0:48.42 S `- /usr/bin/program
Here is my top usage
top -hv | -bcEeHiOSs1 -d secs -n max -u|U user -p pid(s) -o field -w [cols]
top
. If you want dynamic refresh, thenhtop
really is your answer. Installhtop
if you dont have it already,and start it. If you are not in "tree mode" already pressF5
to switch to it - now you see the whole tree population on the machine as giant tree. Find your process of interest and presF
to follow it as the leader. Under the leader the tree will now update as processes come and go. – etosan Dec 19 '21 at 06:42