Sophie

Sophie

distrib > CentOS > 5 > x86_64 > by-pkgid > 83087c42ed4aed88a51d7da8f1e04c0c > files > 137

bash-3.2-33.el5.1.x86_64.rpm

#! /bin/bash
#
# pmtop - poor man's `top' for SunOS 4.x
#

CLEAR=clear	# could also be 'tput clear'
HEADER="USER       PID %CPU %MEM   SZ  RSS TT STAT START  TIME COMMAND"

if [ -n "$LINES" ]; then
	SS=$(( $LINES - 2 ))
else
	SS=20
fi

while :
do
	$CLEAR
	echo "$HEADER"
	ps -aux | sort -nr -k 3 | sed ${SS}q
	sleep 5
done

exit 0