I am running top command and the result is as below.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
12446 root 20 0 9869844 6.538g 381348 S 181.2 56.1 2136:08 myps
5019 root 39 19 0 0 0 S 1.3 0.0 426:58.00 kipmi0
I would like to see only myps ,so i used grep as below
top | grep myps
The result looks below
12446 root 20 0 9869844 6.538g 381348 S 181.2 56.1 2136:08 myps
I need header(title ) also need to be displayed. What is the option to do it?
Update: Following answer from the source question worked for me
top -p "$(pgrep -d ',' myps)"