Find Process Using Most CPU and Memory in Linux

Table of Contents

We can use this command to find out which process uses the highest CPU or Memory in Linux.

# ps -eo pid,ppid,cmd,%mem,%cpu –sort=-%mem |head

# ps -eo pid,ppid,cmd,%mem,%cpu –sort=-%cpu |head

How to Find the Process Which Uses Most CPU

The -o (or –format) option of ps allows us to specify the output format. It shows the processes’ PIDs (pid), PPIDs (pid), the name of the executable file associated with the process (cmd), and the RAM and CPU utilization (%mem and %cpu, respectively).

Additionally, we can use –sort to sort by either %mem or %cpu. By default, the output will be sorted in ascendant form, but we can reverse that order by adding a minus sign in front of the sort criteria.

This is an example of this.

$ ps -eo pid,ppid,cmd,%mem,%cpu –sort=-%cpu |head
5424 1 /u00/app/19.3.0/grid/bin/os 0.5 2.5
8081 1 asm_vktm_+ASM1 0.0 1.6
57124 1 ora_vktm_test21 0.0 1.6
6623 1 /u00/app/19.3.0/grid/bin/or 0.1 1.3
6803 1 /u00/app/19.3.0/grid/bin/or 0.3 1.1
57185 1 ora_dia0_test21 0.1 0.9
5549 1 /u00/app/19.3.0/grid/bin/oc 0.7 0.8
3133 1 /u00/app/19.3.0/grid/bin/oh 0.3 0.7
4005 1 /u00/app/19.3.0/grid/bin/ev 0.0 0.6


We can use this command to get the start time of the process.

[root@hostname ~]# ps -eo pid,lstart,cmd

How to Find the Process Which Use Highest Memory

We can use this command to get the process info which uses the highest memory.

# ps -eo pid,ppid,cmd,%mem,%cpu –sort=-%mem |head

# ps -eo pid,ppid,cmd,%mem,%cpu –sort=+%mem |head

Related Post:

High CPU Utilization For a Process on Linux

CPU utilization Not Evenly distributed is dedicated to providing comprehensive information on using Linux.

We hope you find our site helpful and informative.

Learn More


RHCSA Practice Exam

RHCSA Practice Exam A General Notes Here are some tips to ensure your exam starts with a clean environment: You do not need external servers

Read More »