How to find top 10 memory used process in AIX by topas commands

How to find top 10 memory used process in AIX by topas commands

Welcome!

Try the commands

topas -P
svmon -P

In my Unix experience the resident memory size matters most, more than the full/virtual/paged size.
AIX might further divide the resident memory into DATA RES and TEXT RES, then I guess one should sum 'em up.

Thank you for the reply.
When I tried the command topas -P, not seeing %mem column. Getting below columns

                                    DATA  TEXT  PAGE                  PGFAULTS
USER          PID     PPID PRI  NI   RES   RES SPACE    TIME  CPU%   I/O   OTH COMMAND

Please guide me for sorting based on top MEM utilization processes

@avinashmy
does man topas help in any way?

1 Like

Hi,

Thanks for the reply. I wanted to write a script which has top 10 memory and CPU utilization from topas command. I tried man topas but didnot get much information. Please help me here

I would do it with the ps command.
After reading
man ps
especially the section with -o format
I assembled the following command

ps -e -o pid,ppid,rss,vsz,pcpu,user,args

In older AIX, you might need to replace vsz by size
In a shell script you can post-process it like this:

ps -e -o pid,ppid,rss,vsz,pcpu,user,args |
{
  IFS= read -r header; printf "%s\n" "$header"
  sort -n -k3,3 -k5,5 -k4,4
}

I.e. it sorts numerically, primarily on field 3 (rss, resident memory), then field 5 (pcpu, percent cpu), then field 4(vsz, virtual memory).
You can pipe the sort output to tail, or run it with -r and pipe to head.

2 Likes

Hi MadeInGermany,
Thanks a lot for the suggestion. It worked for me. Kindly guide me on sorting based on CPU utilization process (top 10 process)

sort -r (reverse), primarily on field 5, and piped to head:
sort -r -n -k5,5 -k3,3 -k4,4 | head

Thank you for the quick reply and help

Please help me to understand what is the difference between
ps -ef -o pid,ppid,rss,vsz,pcpu,user,args and ps -e -o pid,ppid,rss,vsz,pcpu,user,args

i.e ps -e -o & ps -ef -o

ps -f is a fixed format.
ps -o format is a custom format.
Both are standard in POSIX (portable).
Together the behavior is undefined in POSIX. On some Unix it might give an error. Since I don't have an AIX system I don't know what happens there. I simply avoid it. Additional fields I put in the -o format. See
man ps
args should be the last field because it can consist of fields itself.

1 Like

Got it. Thank you :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.