Memory & CPU Utilization by a particular Process/Command in Linux/UNIX

Share this article with your friends
Overview :

with help of “ps” and “pidof” commads we can determine how much cpu and memory is consumed or used by particular process and command.

Where “ps(process status)” displays information about the current active processes.Pidof finds the process id’s (pids) of the named programs. It prints those id’s on the standard output.

Example:1 Show how much CPU & Memory Consumed by Chrome:

# ps -p $(pidof chrome | sed 's/\s/,/g') -o %cpu,%mem,cmd

Output of above command :


Example :2 CPU and Memory Consumed By MYSQL daemon

 # ps -p $(pidof mysqld | sed 's/\s/,/g') -o %cpu,%mem,cmd


Example:3 Memory & CPU utilized by Apache Daemon-HTTPD

 # ps -p $(pidof httpd | sed 's/\s/,/g') -o %cpu,%mem,cmd


Free Download Linux e-Books

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *