4 pgrep command examples in Linux/Unix
Some times it’s required for us to know what is the RAM used by an application. Suppose in your machine Apache service or Mysql service is consuming up all your RAM. So how to check it? Is there any direct command to do this? The answer to this is no. We have to use two commands to do this. Here is the way to see what is the ram used by a particular Application. To see all the process run by a particular application, We can user pgrep(process grep). #pgrep application-name Example(in Ubuntu) #pgrep apache 1946 1951 1952 1954 1955 1957 2894 To see all the memory used by a process we use pmap(process mapping ). #pmap pid-of-that-application Example : # pmap 19461946: /usr/sbin/apache2 -k start 00110000 28K r-x– /lib/tls/i686/cmov/librt-2.10.1.so 00117000 4K r—- /lib/tls/i686/cmov/librt-2.10.1.so 00118000 4K rw— /lib/tls/i686/cmov/librt-2.10.1.so 00119000 8K r-x– /usr/lib/apache2/modules/mod_auth_basic.so 0011b000 4K r—- /usr/lib/apache2/modules/mod_auth_basic.so 0011c000 4K rw— /usr/lib/apache2/modules/mod_auth_basic.so 0011d000 8K r-x– /usr/lib/apache2/modules/mod_authz_groupfile.so 0011f000 4K r—- /usr/lib/apache2/modules/mod_authz_groupfile.so 00120000 4K rw— /usr/lib/apache2/modules/mod_authz_groupfile.so 00121000 16K r-x– /usr/lib/apache2/modules/mod_deflate.so 00125000 4K r—- /usr/lib/apache2/modules/mod_deflate.so 00126000 4K rw— /usr/lib/apache2/modules/mod_deflate.so 00129000 76K r-x– /lib/tls/i686/cmov/libnsl-2.10.1.so 0013c000 4K r—- /lib/tls/i686/cmov/libnsl-2.10.1.so 0013d000 4K rw— /lib/tls/i686/cmov/libnsl-2.10.1.so 0013e000 8K rw— [ anon ] 00140000 32K r-x– /usr/lib/apache2/modules/mod_autoindex.so 00148000 4K r—- /usr/lib/apache2/modules/mod_autoindex.so 00149000 4K rw— /usr/lib/apache2/modules/mod_autoindex.so 0014a000 80K r-x– /lib/libz.so.1.2.3.3 0015e000 4K r—- /lib/libz.so.1.2.3.3 0015f000 4K rw— /lib/libz.so.1.2.3.3 00160000 8K r-x– /lib/libcom_err.so.2.1 00162000 4K r—- /lib/libcom_err.so.2.1 00163000 4K rw— /lib/libcom_err.so.2.1 00164000...
Read More