list all processes linux

Linux List All Processes by Name, User, PID

Last updated on March 13th, 2021 at 03:19 am

Many times you need to list all processes in Linux to find out which processes are running, if a user is running any process, or if a specific process is running. Here’s how to list all processes by name, user, PID. You can use it to list all processes in Ubuntu, CentOS, Fedora, Redhat, and other Linux systems

 

How to List all Processes in Linux

Here are the steps to list all processes in Linux/Unix. There are various commands like ps, top, htop and pgrep to list all processes in Linux. We will use ps command to list processes.

Open terminal and run the following command to list all processes in Linux.

$ ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0  24336  2284 ?        Ss   Sep01   0:02 /sbin/init
root         2  0.0  0.0      0     0 ?        S    Sep01   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    Sep01   0:00 [ksoftirqd/0]
root         4  0.0  0.0      0     0 ?        S    Sep01   0:00 [kworker/0:0]
...

In the above command,
a = show processes for all users
u = display the process’s user/owner
x = also show processes not attached to a terminal

The above command will list all running processes.

Bonus Read : How to Search a File in Linux

 

List all processes by User

Here’s the command to list all processes by a specific user, say, john

$ ps -u john

OR

$ ps -U john

In the above command,
-u : Show all processes by RUID
-U : Display all processes by EUID

You can also use top or pgrep commands to list processes by user in Linux.

$ top -U john
$ pgrep -u john

Bonus Read : How to Create Zip and Unzip file in Linux

 

List Processes by Name

Here’s the command to list all processes by a specific name, say, firefox

$ ps aux | grep firefox

In the above command, we pass the output of ps aux to grep command and search for string “firefox”.
You can also use pgrep command for this purpose. It searches the current running processes and lists PIDs of matching processes.

$ pgrep firefox

Bonus Read : How to Install Zip File in Linux

 

List Processes by PID

Here’s the command to list all processes by a specific PID, say, 1234

$ ps -p 1234

or

$ ps aux | grep 1234

Hopefully, now you can easily list all processes in Linux/Unix.

Ubiq makes it easy to visualize data in minutes, and monitor in real-time dashboards. Try it today!