How to see process created by specific user in Unix/linux
I want to see list of process created by specific user or group of user in Linux
Can I do it using ps
command or is there any other command to achieve this?
To view only the processes owned by a specific user, use the following command:
top -U [username]
Replace the [username] with the required username
If you want to use ps then
ps -u [username]
OR
ps -ef | grep <username>
OR
ps -efl | grep <username>
for the extended listing
Check out the man ps page for options
Another alternative is to use pstree wchich prints the process tree of the user
pstree <username or pid>
try this one
ps -fp $(pgrep -u <username>)
Note that -e
(show all processes) overrides -u
and makes it be ignored.
I was passing -e
all the time without knowing what the option does, because I usually used ps -ef
, and that made -u
not work.
So if you want full listing you can keep the -f
:
ps -fu USERNAME
Tested on Ubuntu 22.10,