shell - Top active users in linux -


i'm trying learn basic linux i'm doing bit of homework. need write shell script displays in real time top x users number of active processes delay of n seconds (where x , n command line parameters).

i pretty know how this, except core part of it: how can find top users number of active processes?

i fooled around top command, did not got me want be.

expanding on william's post above,

head -5 show top 5.

sleep 10 sleep 10 sec between re-checks.

i'll leave figure out how check 2 arguments , use $1 , $2 in right places.

while [ 1 ]    date    ps ax -o user | sort | uniq -c | sort -rn | head -5    sleep 10 done 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -