pscpu

 $ ./pscpu -h
NAME
        pscpu

SYNOPSIS
        pscpu

DESCRIPTION
        outputs the 5 first processes that consumes the most CPU time, in ascending order

Use case:

 $ ./pscpu
gmonard   2619  1.3  5.5 831300 219248 ?       Sl   09:36   0:23 /usr/local/lib/opera/opera -geometry 1280x800+0+0
root      2027  1.3  0.0 193460  3940 ?        Sl   09:35   0:24 /usr/lib/udisks/udisks-daemon
root      1234  2.0  1.5 169712 60116 tty7     Rs+  09:31   0:41 /usr/bin/X :0 vt7 -br -nolisten tcp -auth /var/run/xauth/A:0-boRdJb
gmonard   2216  2.3  2.2 858076 89192 ?        Sl   09:35   0:40 kwin -session 106765640000135841344900000022410000_1366154194_510451
gmonard   3706 72.4  0.0 1686316  724 pts/4    D+   10:04   0:03 /opt/g09.B01-pgi64/g09/l716.exe 0 /home/gmonard/tmp/Gau-3706.chk 0 /home/gmonard/tmp/Gau-3706.int 0 /home/gmonard/tmp/Gau-3706.rwf 0 /home/gmonard/tmp/Gau-3706.d2e 0 /home/gmonard/tmp/Gau-3706.scr 0 /home/gmonard/tmp/Gau-3703.inp 0 junk.out 0 /home/gmonard/tmp/Gau-3706.nex 0

Commands to include in your bash script: ps, sort, tail (or head)