Top CPU Process on Linux
Top CPU Process on Linux
Let’s see how to display the top CPU process on a Linux system. This can be achieved by combining several commands, such as ps, sort, head/ tail, etc.
🐧Display Top CPU Process
Let’s find the top CPU process and display it on the screen. The top CPU process is the process that consumes the most CPU at the time when we execute the command. Note that the result is dynamic and not constant.
Open the terminal prompt.
Issue the following command:
$ ps -aux
The ps stands for process status. It is used to display information about active processes on a Linux system. It provides a snapshot of the processes running when you execute the command.
The %CPU column is the second column of the command output.
$ ps -aux | sort -n +2 | tail -1
This command helps us detect and debug slow machine performance. For example, it checks if any process consumes a high CPU percentage usage.
All processes are sorted in ascending order based on the second column. The process with the highest CPU usage will be displayed last. The tail -1 will get the last result, i.e., the real-time process with the highest CPU usage.
—
Linux Tutorials
Linux commands tutorial on this website:
For more information on Ubuntu Linux, visit the website: