An alternative to top for AIX

Almost everybody loves the GNU command top. Top displays information about what's going on at your system. Some systems don't provide top, this script can be used as an alternative for top:

#!/bin/sh

# If the shell script is stopped with CTRL+C, the screen
# might need to be sized correctly.
trap 'eval $(resize); exit 2' 2

# A loop to display activity.
while [ 1 ] ; do
eval $(resize)
output=$(ps -eF "pcpu time pid user comm" | grep -v TIME | sort -rn | head -$(("$LINES"-2)))
echo ' %CPU      TIME    PID     USER    COMMAND'
echo "$output"
sleep 3
done

Comments

Alternates and alternatives

Alternates and alternatives of the ache for the humans. The problem and solutions for the further category of the http://www.aussiessay.net/ site for all success. The dynamics of the alternates with the acute and different.

Nice tips. I'm looking for

Nice tips. I'm looking for this information. - Marla Ahlgrimm

This is misleading because

This is misleading because the %CPU used in top is since the last sample interval and ps is over the lifetime of the process. So you end up with something that sort of looks like top, but just isn't. This distinction is dramatic. To see the difference try a CPU loading loop like (while true; do true; done &) and send it a SIGSTOP, then watch the top of either one, then send it a SIGCONT.

Excellent tip. Just what I

Excellent tip.
Just what I was looking for.

Good tip! I will probably be

Good tip! I will probably be working on some AIX systems soon so I will keep this one in mind. I looked at the Unix Rosetta stone and it lists some good utils for AIX - see

http://www.bhami.com/rosetta.html

but I had to use another web browser (Galeon) as Firefox would not work with that site.

Great script, many thanks!

Great script, many thanks! Looks simple but works like a charm. Delicious.

About Consultancy Articles Contact




References Red Hat Certified Architect By Robert de Bock Robert de Bock
Curriculum Vitae By Fred Clausen +31 6 14 39 58 72
By Nelson Manning [email protected]