Linux Commands

How to List Processes in Linux

Processes are the running instances of programs that consume system resources. Listing these processes helps you monitor system activity, and  troubleshoot issues. That’s why there are multiple tools and utilities in Linux that you can use to list the currently running process.

However, many beginners don’t know the exact way to list the process without errors. So, in this short article, we will explain different methods to list the process in Linux. We have divided this section into multiple parts to give you the best commands to list the processes in Linux.

The ps Command

The ps, or “process status,” is the most common utility to list processes in the terminal:

ps -e

ps-e-command-results

The -e option guides ps to show every process regardless of whether the user owns those processes. Furthermore, you can customize the ps command to produce additional details using the “aux” options:

ps aux

ps-aux-command-result

The top Command

If you desire to view the real-time list of system processes, please use the top command. It continuously updates the process list according to new and completed processes, providing more accurate results:

top

top-command-result

The above command on execution shows the list of processes as per their CPU consumption. Moreover, You can not interact with the terminal until you press “q” to quit the top utility.

The pstree Command

The pstree is very different from the above two commands because it displays the hierarchical relationship of processes in a tree-like structure. It helps you visually understand how a process starts and its connection with other active processes.

pstree

pstree-command-result

The Glances Tool

The Glances tool provides a brief overview of the currently running process. However, you have to install the tool by running the below command: 

Operating System Command
Debian/Ubuntu sudo apt install glances
Fedora sudo dnf install glances
Arch Linux sudo pacman -Sy glances
openSUSE sudo zypper install glances

After the successful installation, you can open the Glances by running the following command:

glances

glances-command-results

A Quick Summary

Knowing how to list processes can help free up the space and turn off the currently running process. This article covered four ways– the top, ps, pstree, and pgrep commands. You can choose to use any of them according to what suits you best. We recommend you use any commands carefully, or you may get errors.

About the author

Prateek Jangid