How to check top 10 CPU consuming process in Linux Ubuntu. How to find which process is taking how much CPU in Unix Systems – Linux and Ubuntu. Display Linux CPU usage per process in Terminal.
List Top Memory Consuming Processes In Terminal
The ps command can be mixed with various options to show the list of top processes sorted by RAM and CPU usage. Run the following command in Terminal to see the top running processes by RAM and CPU usage:
$ ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head
Below is the screenshot of the command output:
Explaining the command and all the options users:
- -A Select all processes. Identical to -e.
- -e Select all processes. Identical to -A.
- -o User-defined format. Option of ps allows to specify the output format. Format is a single argument in the form of a blank-separated or comma-separated list, which offers a way to specify individual output columns.
- –pid pidlist process ID. Identical to -p and p.
- –ppid pidlist parent process ID. This selects the processes with a parent process ID in pidlist. That is, it selects processes that are children of those listed in pidlist.
- –sort Specify sorting order.
- cmd simple name of executable
- %cpu CPU utilization of the process in “##.#” format. Currently, it is the CPU time used divided by the time the process has been running (cputime/realtime ratio), expressed as a percentage.
- %mem Ratio of the process’s resident set size to the physical memory on the machine, expressed as a percentage.
List Top 10 CPU Consuming Processes
Similarly you can also print the top 10 CPU consuming processes. Run the following command given below:
ps -eo pid,comm,%cpu | sort -rk 3 | head