150

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?

1
  • 7
    ps -u username. Most commands have a manual page which you can read with man the-command. Aug 4, 2013 at 9:03

2 Answers 2

198

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>
3
  • 3
    All ` ... | grep <username>` solutions don't work if you have two usernames which are longer than N chars. In my case N is 6.
    – guettli
    Jan 19, 2018 at 10:44
  • 1
    Note: I got an error for top -U [username], and top -u [username] worked for me instead. Debian 9. So if anybody else gets an error with the -U form, try the lowercase.
    – Gloweye
    Oct 29, 2018 at 9:08
  • 1
    Note: On FreeBSD it is ps -U <username> (notice the capital U) Apr 28, 2021 at 17:13
7

try this one

ps -fp $(pgrep -u <username>)
3
  • How is this better than ps -u <username>, as mentioned in the existing answer (or ps -fu <username> if you want process details)? Jan 23, 2018 at 8:27
  • ps -u doesn't provide full process details, but ps -fu <username> does. Agree ps -fu is a best solution
    – user939407
    Jan 24, 2018 at 10:03
  • pgrep -u <username> | xargs ps u shows even more process details.
    – ks1322
    Apr 18 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.