Advertisements

Solaris ps: show processes and sort by CPU consumption

Here are the options that you can use with ps

root@solaris:/ # ps -eo
ps: option requires an argument — o
usage: ps [ -aAdeflcjLPyZ ] [ -o format ] [ -t termlist ]
[ -u userlist ] [ -U userlist ] [ -G grouplist ]
[ -p proclist ] [ -g pgrplist ] [ -s sidlist ] [ -z zonelist ]
‘format’ is one or more of:
user ruser group rgroup uid ruid gid rgid pid ppid pgid sid taskid ctid
pri opri pcpu pmem vsz rss osz nice class time etime stime zone zoneid
f s c lwp nlwp psr tty addr wchan fname comm args projid project pset

If I use user,pid,ppid,stime,tty,pcpu,pmem,comm the header is shown below

root@solaris:/ # ps -eo user,pid,ppid,stime,tty,pcpu,pmem,comm | head -1
USER PID PPID STIME TT %CPU %MEM COMMAND

I have sorted the colum by %CPU column

root@solaris:/ # ps -eo user,pid,ppid,stime,tty,pcpu,pmem,comm | sort -n -k6 | tail
oracle 93 9842 nov_09 ? 0.1 1.1 /usr/software/oracle/product/j2ee_10131/jdk/bin/java
oracle 1973 9842 nov_10 ? 0.1 1.7 /usr/software/oracle/product/j2ee_10131/jdk/bin/java
oracle 6417 9842 nov_02 ? 0.1 0.6 /usr/software/oracle/product/j2ee_10131/jdk/bin/java
oracle 9842 4351 ago_13 ? 0.1 0.1 /usr/software/oracle/product/j2ee_10131/opmn/bin/opmn
oracle 21623 9842 ago_13 ? 0.1 1.4 /usr/software/oracle/product/j2ee_10131/jdk/bin/java
oracle 21640 9842 ago_13 ? 0.1 0.4 /usr/software/oracle/product/j2ee_10131/jdk/bin/java
oracle 24709 9842 nov_11 ? 0.1 1.5 /usr/software/oracle/product/j2ee_10131/jdk/bin/java
root 2379 1599 ago_13 ? 0.7 0.0 /usr/sbin/nscd
producao 5300 4425 ago_13 ? 2.0 0.0 xcomtp
oracle 8840 9842 ago_14 ? 77.3 3.3 /usr/software/oracle/product/j2ee_10131/jdk/bin/java

Advertisements
%d bloggers like this: