Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 20 lines (15 sloc) 0.353 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#!/bin/bash

if [ $# -ne 1 ]; then
    echo "usage: $0 [cpu|mem]"
    exit 99
fi

case $1 in
    cpu) col=7 ;;
    mem) col=6 ;;
    *) echo "parameter error"
         exit 99
    ;;
esac

/bin/ps axwo 'stat uid pid ppid vsz rss pcpu comm args' >/tmp/$$

cat /tmp/$$ |sort -k${col}rn |head -n 3 |awk '{printf "%s/%s\n",$3,$8}' |xargs

#rm -f /tmp/$$
Something went wrong with that request. Please try again.