Linux Commands

How to List Running Processes in Linux

Whenever you run a process, it consists of various elements such as the user input, retrieving and processing the data from the files, program instructions, and more. Primarily, processes have two types: foreground processes and background processes. While the foreground processes usually depend on user input, the background processes run on their own without the need for user involvement.

One of the frequent tasks of Linux users is listing those processes. Why? It helps in system monitoring, performance analysis, troubleshooting, resource management, security auditing, etc. However, many users are unaware of the methods that are used for this task. So, this guide will briefly discuss the commands to list the running processes in Linux.

How to List the Running Processes in Linux

You can use a few commands to list the running processes. Therefore, we will divide this section further into multiple parts to demonstrate the use of each command.

1. The Ps Aux Command

Ps aux displays the in-depth details about the current processes. It presents a comprehensive list of processes with their PIDs, CPU usage, memory consumption, and other stats in a human-readable format:

ps aux

Moreover, if you want to view the processes that are run by a specific application, use it with the “grep” command.

ps aux | grep app_namep

Replace the term “app_name” with your intended application name. This command pipelines the output from the “ps aux” command to the “grep” command as input. After that, the “grep” command will filter out the result based on the application name that you provide.

For example, if we want to search the processes that are run by the snap application, the command would be:

ps aux | grep snap

2. The Top Command

The table of processes (top) command displays the kernel-managed running processes in a real-time view. Besides PID, it provides an information about which user started the process, its resource utilization, and time consumed.

top

3. The Pstree Command

Pstree displays the hierarchy of processes in a tree format which helps a user to check the connection between different processes.

pstree

Conclusion

Listing the running processes in Linux is crucial for maintaining the system health, troubleshooting errors, system optimization, and security. It provides a valuable insight into whatever’s happening inside the system that aids the users in making informed decisions to improve the system’s performance. Therefore, this guide comprehensively explains the commands that are used to list the running processes. We discussed three effective commands – ps aux, pstree, and top – all of which serve different purposes in process listing.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.