twitter

How To's Tutorials

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

 

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  :

 

Memory and CPU utilization

 

Example :2 CPU and Memory Consumed By MYSQL daemon

 

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

 

Memory and CPU utilization

 

 

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

 

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

 

Memory and CPU utilization

 

Post Your Comments
Name:
Email:
Comment:
Security Code  *
Enter Security Code  *
Can't read the image? click here to refresh