There are lots of ways to do this, we can use pipes here.
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
uniq command can eliminate or count duplicate lines in a presorted file.
reference: http://www.go2linux.org
No comments:
Post a Comment