使用脚本获得 消耗Linux操作系统内存的前10个操作系统进程
参考自:
How to Calculate Memory Usage on Linux (文档 ID 1630754.1)
[root@rhel63single ~]# uname -r
2.6.32-279.el6.x86_64
[root@rhel63single ~]# uname -a
Linux rhel63single 2.6.32-279.el6.x86_64 #1 SMP Wed Jun 13 18:24:36 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
[root@rhel63single ~]# ps -e -orss,pid=,user=,args=, | sort -b -k1,1n | pr -TW$COLUMNS| tail -10
19868 2635 grid asm_gmon_+ASM
20100 2625 grid asm_dbw0_+ASM
20620 2511 grid /u03/app/11.2.0/grid/bin/cssdagent
21160 2306 root /usr/bin/Xorg :0 -nr -verbose -audit 4 -auth /var/run/gdm/auth-for-gdm-wAZuvJ/database -nolisten tcp vt1
21516 2657 grid oracle+ASM (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
22552 2633 grid asm_rbal_+ASM
23520 2528 grid /u03/app/11.2.0/grid/bin/evmd.bin
26956 2547 grid /u03/app/11.2.0/grid/bin/ocssd.bin
41104 2199 grid /u03/app/11.2.0/grid/bin/ohasd.bin reboot
227524 2507 grid /u03/app/11.2.0/grid/bin/oraagent.bin
[root@rhel63single ~]#
对结果的解读:
第一列是RSS(Resident Set Size ),以KB为单位
第二列是操作系统的pid
第三列是操作系统用户名
第四列是执行的命令