top and pidof


https://www.howtoforge.com/linux-pidof-command/

https://electrictoolbox.com/linux-top-only-one-process/




ps -e

or

ps -ef

ps -e
labuser@saltsackmaster:~$ ps -e  | grep salt
12798 ?        00:00:10 salt-master
. . .
13301 ?        00:02:08 salt-minion
13848 ?        00:07:16 salt-proxy
14033 ?        00:07:26 salt-proxy

>>> find the process:  /usr/bin/python3

labuser@saltsackmaster:~$ ps -ef  | grep salt
root     12798     1  0 Jun20 ?        00:00:10 /usr/bin/python3 /usr/local/bin/salt-master -d
. . . 
root     13301     1  0 Jun20 ?        00:02:08 /usr/bin/python3 /usr/local/bin/salt-minion -d
root     13848     1  0 Jun20 ?        00:07:16 /usr/bin/python3 /usr/local/bin/salt-proxy --proxyid=qfx5100-1-rl102 -d
root     14033     1  0 Jun20 ?        00:07:26 /usr/bin/python3 /usr/local/bin/salt-proxy --proxyid=srx300-1-rl102 -d
labuser  30525 27955  0 09:07 pts/0    00:00:00 grep --color=auto salt

pidof python3
pidof
labuser@saltsackmaster:~$ pidof python3
14033 13848 13301 12818 12817 12816 12815 12813 12812 12805 12804 12803 12800 12799 12798 1069 941

top using filer

top -p `pidof python3 | sed 's/ / -p /g'`


top -p `pidof python3 | sed 's/ / -p /g'`
labuser@saltsackmaster:~$ top -p `pidof python3 | sed 's/ / -p /g'`
top - 09:11:16 up 2 days,  4:02,  2 users,  load average: 0.00, 0.02, 0.05
Tasks:  17 total,   0 running,  17 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.5 us,  1.5 sy,  0.0 ni, 97.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  4039736 total,  1736720 free,   931900 used,  1371116 buff/cache
KiB Swap:  3649532 total,  3649532 free,        0 used.  2836784 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
13848 root      20   0 1372236 137060  19072 S   0.3  3.4   7:17.44 salt-proxy
13301 root      20   0 1098356  62016  12508 S   0.3  1.5   2:08.41 salt-minion
14033 root      20   0 1372004 137316  19172 S   0.0  3.4   7:26.79 salt-proxy
12818 root      20   0 1022212  65216  11776 S   0.0  1.6   0:02.80 salt-master
12817 root      20   0 1022856  65872  11652 S   0.0  1.6   0:02.97 salt-master
12816 root      20   0 1023400  66116  11776 S   0.0  1.6   0:03.01 salt-master
12815 root      20   0 1023588  65688  11776 S   0.0  1.6   0:02.97 salt-master
12813 root      20   0  324500  50508   4440 S   0.0  1.3   0:06.95 salt-master
12812 root      20   0 1023616  65752  11776 S   0.0  1.6   0:02.91 salt-master
12805 root      20   0  627604  52268   6312 S   0.0  1.3   0:00.20 salt-master
12804 root      20   0  324580  50224   4304 S   0.0  1.2   0:10.55 salt-master
12803 root      20   0 1047284  87452  10484 S   0.0  2.2  33:15.27 salt-master
12800 root      20   0  343236  51480   4952 S   0.0  1.3   0:00.12 salt-master
12799 root      20   0  331964  52128   6676 S   0.0  1.3   0:00.02 salt-master
12798 root      20   0  324500  53492   7432 S   0.0  1.3   0:10.84 salt-master
 1069 root      20   0  185836  20100  12200 S   0.0  0.5   0:00.16 unattended-upgr
  941 root      20   0  169140  17132   9348 S   0.0  0.4   0:00.18 networkd-dispat