Number of proccesses per user on Linux

Written by
Date: 2010-12-20 10:36:30 00:00


How to know how many processes each user is running?, there are lots of ways to do this, I've found this some time ago in the ubuntu forums I think.

I can not find right now a real scenario when you may need this, but it is a good example about how to use pipes to get a different output, with a whole different purpose.

Have fun:

How to count how many processes each user is running in Linux

ps hax -o user | sort | uniq -c

ps will list the processes, h will remove the header, -o user prints only the user column, sort sorts in alphabetical order, so uniq can count each occurrence and show the number of occurrences instead of all the occurrences themselves.