APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Unix, Xenix and ODT General FAQ

This article is from a FAQ concerning SCO operating systems. While some of the information may be applicable to any OS, or any Unix or Linux OS, it may be specific to SCO Xenix, Open There is lots of Linux, Mac OS X and general Unix info elsewhere on this site: Search this site is the best way to find anything.

How can I monitor cpu usage (Old Sco Unix)?

This script is useful:

        # @(#)/usr/local/bin/mon, quick & dirty process monitor
        # @(#)Bela Lubkin, June 1997 & December 2000
        # @(#)Bob Stockler, December 2000
        # @(#)Jean-Pierre Radley, December 2000
        trap 'echo "$CN\c";trap 0;exit' 0 2 3 15
        trap 'trap 0;exit' 1
        N=`tput lines`
        EL=`tput el` ED=`tput ed` CL=`tput clear` HO=`tput home`
        CF=`tput civis` CN=`tput cnorm` F="%12.2f%3d$ED$HO"
        echo "$CF$CL\c"
        HDR="`ps -p1 -opid -opcpu -oc -oargs | head -1`"
        while :
          ps -e -opid= -opcpu= -oc= -oargs= |
          sort -rn +1 |
          mawk -v H="$HDR" -v N="$N" -v E="$EL" -v F="$F" '
            BEGIN{print H;N-=2}
            $2>0||$3{print substr($0,1,79) E;P+=$2;C+=$3}
            END{printf F,P,C}'
          sleep ${1-1}  # sleep time on script's command line (default 1 sec.)

(change "mawk" to "awk" if you don't have it- it still runs, just more slowly)

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> (SCO Unix) How can I monitor cpu usage?

Wed May 3 20:49:25 2006: 2005   shoujie

Try vmstat 5


Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

We're terrible animals. I think that the Earth's immune system is trying to get rid of us, as well it should. (Kurt Vonnegut)




Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode