1832869 Members
7873 Online
110048 Solutions
New Discussion

Re: TOP Memory Sorting

 
SOLVED
Go to solution
Hank Phan
New Member

TOP Memory Sorting

Hello...I'm at a company where due to cost and licensing they have chosen not to install Glance/GlancePlus(even the trial version).

So...is there a way to sort by the RES column in TOP? I've read threads where supposedly the 'M' command while in TOP will sort that column...but no dice. This is on HP-UX B.11.23.

Any comments appreciated, thanks in advance.
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor
Solution

Re: TOP Memory Sorting

Hi:

You can use 'ps' under the XPG4 (UNIX95) option and sort processes by descending process size:

# UNIX95= ps -e -o "user,vsz,pid,ppid,args" | awk 'NR>1' | sort -rnk2

Note the blank (space) character after the equal sign and before the 'ps' command. This sets the UNIX95 option for the command line only.

Regards!

...JRF...
Hank Phan
New Member

Re: TOP Memory Sorting

Thanks James...but there's no way to sort the RES column in TOP?
Heironimus
Honored Contributor

Re: TOP Memory Sorting

I think the version of top that HP ships can not do this. It doesn't support a lot of things that newer versions of top do. You could try to install a recent version from the Porting and Archive Centre or compile it yourself.
spex
Honored Contributor

Re: TOP Memory Sorting

Hi Hank,

William LeFebvre's version of top, available at the Porting and Archiving Center, does support sorting top output by a number of fields, including res.

According to top(1):
-ofield
Sort the process display area on the specified field. The field
name is the name of the column as seen in the output, but in
lower case. Likely values are "cpu", "size", "res", and "time",
but may vary on different operating systems. Note that not all
operating systems support this option.

http://hpux.connect.org.uk/hppd/hpux/Sysadmin/top-3.6alpha9/man.html

PCS