ps_mem – Show how much RAM is used per program

Photo of author

By rasho

ps_mem is a tool that can be used to show how much memory is used per program. It does this by calculating the sum of private RAM for program processes and the sum of shared RAM for program processes.

How to install ps_mem on CentOS 6.5/6.6/7

Enter following command to install ps_mem:

# yum install ps_mem -y

How to use ps_mem

Enter “ps_mem” in your console:
[ads]

root@rashob ~]# ps_mem

 Private  +   Shared  =  RAM used	Program

 64.0 KiB +  10.0 KiB =  74.0 KiB	qmail-clean
 80.0 KiB +   3.0 KiB =  83.0 KiB	closeinput
 76.0 KiB +  10.0 KiB =  86.0 KiB	svscan
 84.0 KiB +  10.0 KiB =  94.0 KiB	qmail-rspawn
 92.0 KiB +   9.0 KiB = 101.0 KiB	qmail-lspawn
152.0 KiB +  16.5 KiB = 168.5 KiB	qmail-send
200.0 KiB +  23.0 KiB = 223.0 KiB	mysqld_safe
188.0 KiB +  43.5 KiB = 231.5 KiB	atd
256.0 KiB +  39.0 KiB = 295.0 KiB	dbus-daemon
268.0 KiB +  35.0 KiB = 303.0 KiB	xinetd
276.0 KiB +  56.5 KiB = 332.5 KiB	auditd
340.0 KiB +  30.0 KiB = 370.0 KiB	init
340.0 KiB +  38.0 KiB = 378.0 KiB	udevd
340.0 KiB +  69.0 KiB = 409.0 KiB	mingetty (6)
..............................................
  8.6 MiB +  67.0 KiB =   8.6 MiB	named
  7.4 MiB +   3.0 MiB =  10.4 MiB	nginx (6)
 39.0 MiB +   4.8 MiB =  43.8 MiB	php (3)
 41.3 MiB +   7.0 MiB =  48.3 MiB	php-cgi (2)
 19.0 MiB +  31.2 MiB =  50.2 MiB	httpd (5)
102.9 MiB +  96.5 KiB = 103.0 MiB	mysqld
---------------------------------
                        304.6 MiB
=================================

To show the command line of each program:

# ps_mem -s

To refresh the program memory usage every X seconds:

# ps_mem -w X

Leave a Comment