How To Check Cpu Usage Of a Process In Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To check the CPU usage of a process in Linux, you can use the command “top”. This command provides an overview of the CPU usage of all processes running on the system, including the ones that are currently active. You can also use the command “ps” to list all running processes and their CPU usage.
1. Using Top Command: The top command displays all the running processes along with their CPU usage. It is the most popular tool used to monitor the system resources such as CPU utilization, Memory utilization and Disk I/O etc. To check the CPU usage of a particular process, use the following command.
Syntax: top –p
PID
Example: top –p 741
2. Using ps command: The ps command is used to display information about the running processes and their resource utilization. To check the CPU utilization of a particular process, use the following command.
Syntax:
ps –p PID –o %cpu
Example:
ps –p 741 –o %cpu
3. Using ps auxcommand: The ps aux command displays all the running processes on the system along with their resource utilization details like CPU and Memory usage. This command provides more detailed output than the ps command. To check the CPU utilization of a particular process, use the following command.
Syntax: ps aux |
grep PID
Example: ps aux | grep 741