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

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -