How to monitor Memory and CPU usage of the single process by program/executable name(not PID);

  • 1
    try top -p PID
    – Raza
    Jul 18, 2014 at 21:58

2 Answers 2


Try this. if you want with program name

   mypid=`pidof programname` ; top -p $mypid


     top -p `pidof programname`

To monitor one or more instances matching the name:

top -p$(pgrep <program> | tr '\n' ',' | head -c -1)

Use pgrep -f to search the whole command lines for matches.

(Works with htop too.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.