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

Unix, Xenix and ODT General FAQ

Some material is very old and may be incorrect today

© December 2003 (various)

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)

If you found something useful today, please consider a small donation.

Got something to add? Send me email.

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

Printer Friendly Version

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

1 comment

Inexpensive and informative Apple related e-books:

Take Control of IOS 11

iOS 10: A Take Control Crash Course

Take Control of Pages

Take Control of OS X Server

Sierra: A Take Control Crash Course

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

What do such machines really do? They increase the number of things we can do without thinking. Things we do without thinking — there's the real danger. (Frank Herbert)

Linux posts

Troubleshooting posts

This post tagged:




Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode