1, ranging from large to small 10 memory usage processes
PS aux | Head-1; PS aux | Sort-rn +3 | Head-10
To view the process in detail:
Ps-ealf | Head-1; Ps-ealf | Sort-rn +9 | Head-10
# ps aux | head -1 ; ps aux | sort -rn +3 | head -10user pid %cpu %mem sz rss tty stat stime time COMMANDroot 6553834 0.1 3.0 115064 115080 - A Feb 20 86:08 /var/opt/tivoliroot 5701730 0.0 1.0 17480 21956 - a mar 05 1:17 /opt/besclient/pconsole 4456680 0.0 1.0 42456 42464 - a feb 20 3:11 /usr/java5/bin/root 6750376 0.0 0.0 796 824 pts/0 A 11:29:26 0:00 ps auxroot 6488234 0.0 0.0 260 268 - a mar 13 0:02 auditbinroot 6357208 0.0 0.0 236 248 pts/0 a 11:29:26 0:00 sort -rn +3root 5963962 0.0 0.0 1768 1804 -&nBsp a feb 20 0:00 /usr/sbin/rsct/root 5832798 0.0 0.0 836 856 - a 11:29:12 0:00 telnetd -aroot 5570748 0.0 0.0 2128 2096 - a feb 20 0:00 /usr/sbin/rsct/root 5308652 0.0 0.0 7328 7436 - a feb 20 1:01 /usr/sbin/rsct/
2. View memory usage According to a command or process name
# PS aux | Head-1; PS aux | grep Topas
See MORE:
USER PID%cpu%MEM SZ RSS TTY STAT stime time commandroot 2359426 0.0 0.0 1440 1272-a Feb 1:08/usr/bin/topasrroot 61 60578 0.0 0.0 252 pts/0 A 11:36:45 0:00 grep topas
But sometimes PS aux does not show the full utilization of the process in very detail.
3, the user can analyze the memory usage by the root user Svmon
# svmon-gsize InUse free pin virtual mmodememory 1048576 1037487 11089 229668 378796 dedpg space 2097152 2360work PERS cl NT Otherpin 196952 0 0 32716in use 378796 0 658691PageSize poolsize inuse pgsp pin virtuals 4 KB-793327 2360 49188 13463 6m KB-15260 0 11280 15260
InUse: Is the amount of physical memory used, here is the unit in 4 K, so 1037487*4096=4249546752 (424M)
Virtual: Is the amount of memory used, this is in 4 K units, so 378796*4096=1551548416 (155M)
4, shows the 3 processes using the most physical memory:
# svmon-up-t 3|grep-p pid|grep ' ^.*[0-9] ' 6553834 java 51279 8917 0 50938 n Y N4456680 java 34626 8874 0 34608 N y N570 1730 Besclient 29564 8882 0 25689 y y N
The output is in the format order of Pid Command Inuse Pin pgsp Virtual 64-bit mthrd
You can calculate that the X program uses a 51279x4096=210038784, about 210MB
5, show swap area with up to 3 processes using physical memory
# svmon-gp-t 3|grep-p pid|grep ' ^.*[0-9] ' 1966206 shlap64 26782 8880 0 26771 y N N0 swapper 9872 8912 0 9872 Y n N1 INI T 22094 8836 0 22076 n n N
The size of the swap area used by the first program x is approximately 26782x4096 = 10510336 bytes, approximately 10MB space
6, display the most used segments every three seconds
# svmon-s-T 3-i 3Vsid esid Type Description Inuse Pin pgsp virtual4f08-clnt 37505 0- -11e1-clnt 33623 0--8811- Work kernel pinned heap 12637 6547 8091 19397
Visible, Vsid is the 4f08 segment with the most
7,SVMON-PP 22674
Look at the PID 22674 process used for those files
Pid Command nuse pin pgsp Virtual 64-bit Mthrd22674 java 29333 1611 2756 32404 N yvsid esid Type Description Inuse Pin Pgs P Virtual0 0 Work kernel seg 2979 1593 1659 4561a056-work 3 461e03 2 Work process private 2 931080-pers/d ev/hd2:69742 1 0--f8bd F work shared library data 0 One 9960ee 8 work shmat/mmap 0 0 0 070ec-pers/dev/hd2:69836 1 0 - -
8, through the Ncheck command, check which files are used by Vsid.
Ncheck a056
View Total Physical Memory
# cat Mem1.sh#!/usr/bin/ksh#mem totletotalmem=$ (vmstat-v|head-n 1|awk ' {print $1/256} ') echo "mem totle:" Echo $totalmem M Becho
To see how many physical memory each user occupies
# Cat mem2.shusermem=$ (for username in ' cat/etc/passwd|awk-f: ' {print $} ' dosvmon-u $username |grep $username "" done) US Ermem= ' echo ' $usermem ' |grep-v ' 0 0 0 0 ' |awk ' {print $1,$2/256, ' MB '} ' echo ' singe user Pmem ' echo ' $usermem ' usermem=$ (Echo "$usermem" |awk ' begin{sum1=0;} {sum1=sum1+$2;} End{print sum1;} ') usermem=$ (Echo $usermem |awk-f\. ' {print $} ') echo "Singe user pmem:" $usermem Mbecho
AIX5.3 View system, user, file system memory consumption
#!/usr/bin/ksh# View total amount of Memory: totalmem=$ (vmstat -v|head -n 1|awk ' {print $1/256} ') echo "Total memory (physical memory):" echo $totalmem mbecho# View the memory used by each user: usermem=$ (for username in ' cat /etc/passwd|awk -F: ' {print $1} ' dosvmon -u $username |grep $username " "Done" usermem= ' echo "$usermem" |grep -v "0 0 0 0" |awk ' {print $1, $2/256, "MB"} ' echo "Individual user memory (physical memory):" echo "$usermem" usermem=$ (echo "$usermem" |awk "begin{sum1= 0;} {sum1=sum1+$2;} end{print sum1;} ') usermem=$ (echo $usermem |awk -f\. ' {print $1} ') echo "User memory (physical memory) Total:" $USERMEM mbecho# View File system cache: clientmem1= ' svmon -g|grep "^pin" |awk ' {print $4} ' clientmem2= ' Svmon -G|grep "^in use" |awk ' {print $5} ' clientmem= ' expr $clientmem 1 + $ Clientmem2 ' clientmem= ' expr $clientmem / 256 ' echo ' file system cache (physical memory): "echo $clientmem mbecho# viewing the system using Memory: sysmem=$ (svmon -s -s -u|cut -b 54-|grep -v "0 0 0 0 "|grep [0-9]|awk ' {print $1,$2} ') supremeseg= ' echo " $sysmem "|grep S|awk ' begin{sum1=0;} {sum1=sum1+$2;} END{SUM1=SUM1*16*1024*1024;PRINT SUM1;} ' ' largeseg= ' echo "$sysmem" |grep l|awk ' begin{sum1=0;} {sum1=sum1+$2;} END{SUM1=SUM1*16*1024;PRINT SUM1;} ' ' mediumseg= ' echo "$sysmem" |grep m|awk ' begin{sum1=0;} {sum1=sum1+$2;} END{SUM1=SUM1*64;PRINT SUM1;} ' ' smallseg= ' echo "$sysmem" |grep s|awk ' begin{sum1=0;} {sum1=sum1+$2;} END{SUM1=SUM1*4;PRINT SUM1;} ' ' Sysmem=$ (expr $supremeseg + $largeseg + $mediumseg + $smallseg) sysmem=$ ( expr $sysmem / 1024) echo "System memory (physical memory):" echo $sysmem mbecho# View free Memory: freemem=$ ( vmstat -v|grep free|awk ' {print $1/256} ') echo "free memory (physical memory):" Freemem=$ (echo $ Freemem|awk -f\.&nbsP; ' {print $1} ') echo $freemem mbecho
AIX View high memory-intensive processes