1752762 Members
5086 Online
108789 Solutions
New Discussion юеВ

top output change

 
SOLVED
Go to solution
Aarhonda Coles
Occasional Contributor

top output change

I'm trying to find an option for top that will only give me the list of the top processes, not the average load and memory usage.
Or is there another command to use instead of top?
3 REPLIES 3
Sanjay_6
Honored Contributor

Re: top output change

Hi,

I don't think there is such and option with top.

What you can do is redirect the top output to a file and remove the number of lines on the top that you don't want. You can do this in a script.

Hope this helps.

Regds
Victor BERRIDGE
Honored Contributor

Re: top output change

Hi,
With top you will have to use a temporary file:
# top -n10 -h -f titutu;cat titutu|tail -10
1 ? 1796 root 152 20 298M 111M run 79:36 1.03 1.03 java
1 ? 35 root 152 20 8064K 8064K run 11:46 0.35 0.35 vxfsd
1 ? 5476 patrol 154 39 20800K 13576K sleep 87:17 0.35 0.35 PatrolAgent
0 ? 1501 root 152 20 169M 9156K run 23:47 0.30 0.30 prm3d
0 ? 1273 root 152 20 14044K 3420K run 0:08 0.23 0.23 dmisp
1 ? 1480 root -16 20 24968K 5736K run 25:01 0.22 0.21 midaemon
1 pts/3 6688 vbe 168 32 6144K 856K sleep 28:03 0.21 0.21 top
1 pts/3 6388 vbe 154 26 33876K 7004K sleep 14:56 0.18 0.18 gpm
0 ? 3952 root 152 20 15404K 5256K run 0:47 0.18 0.18 rep_server
0 ? 3976 root 152 20 12828K 2996K run 0:34 0.18 0.18 agdbserver


Now I know you can achieve what you want using unix95 syntax and ps, but at the time Im pretty busy and cant remember...


All the best
Victor
Victor BERRIDGE
Honored Contributor
Solution

Re: top output change

I dont know, what about:
UNIX95= ps -el -o pid,comm,sz|grep -i -v pid|sort -nr -k 3,3| head -10

All the best
Victor