Operating System - HP-UX
1821980 Members
3061 Online
109638 Solutions
New Discussion юеВ

how to list and sort the process by memory usage...

 
SOLVED
Go to solution
blu.karthi
Advisor

how to list and sort the process by memory usage...

hi experts,

Glance showing 95% memory used... i want to sort the process by memory usage...

top also showing same as 95% use...
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor
Solution

Re: how to list and sort the process by memory usage...

Hi :

You could use:

# UNIX95= ps -ef -o vsz= -o pid= -o ppid= -o comm=|sort -krn1,1|more

There is no semicolon after 'UNIX95=". This keeps the setting only for the duration of the command line.

The headings for the columns are supressed. The output is sorted in descending virtual size. see the manpages for 'ps'. You can add or subtract to the fields returned.

Regards!

...JRF...
blu.karthi
Advisor

Re: how to list and sort the process by memory usage...

hi,
thanks for reply....

can you explain the field...
Hakki Aydin Ucar
Honored Contributor

Re: how to list and sort the process by memory usage...

even though there is lots of script around forum, I can say my CPU example by using glance, you have to modify for memory:

http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=109447626+1254344070310+28353475&threadId=1370471

Also I recommend you to use "lsof" command to check memory -> process relation
James R. Ferguson
Acclaimed Contributor

Re: how to list and sort the process by memory usage...

Hi (again):

> can you explain the field...

The manpages explain the meaning of each field (as you would expect):

http://docs.hp.com/en/B2355-60105/ps.1.html

Please also readL

http://forums13.itrc.hp.com/service/forums/helptips.do?#28

Regards!

...JRF...
blu.karthi
Advisor

Re: how to list and sort the process by memory usage...

thank for reply....

UNIX95= ps -ef -o vzm= -o pid -o ppid -o comm= |sort -krn1,1

is working