Search This Blog

Saturday, March 7, 2009

System Memory used total or by a process

VMSTAT
root@vikas ~]# whatis vmstat
vmstat (8) - Report virtual memory statistics
[root@vikas ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 204976 18444 4732 154720 3 5 120 49 178 313 8 2 88 2 0
[root@vikas ~]# vmstat 1 2
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 204976 17948 4744 154724 3 5 120 49 178 313 8 2 88 2 0
0 0 204976 17804 4744 154724 0 0 0 0 4 1050 2 1 97 0 0

FREE

[root@vikas ~]# whatis free
free (1) - Display amount of free and used memory in the system
free (3p) - free allocated memory
free [malloc] (3) - Allocate and free dynamic memory

free -m
free -m -s 5


PMAP
[root@vikas ~]# whatis pmap
pmap (1) - report memory map of a process
[root@vikas ~]#pmap pid

PS
lists all processess.
$ ps aux

[This will show memory% and process]
ps aux | awk {'print $4 " --" $11'}
ps aux | awk '{print $4"\t"$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr

TOP
[root@vikas ~]# whatis top
top (1) - display Linux tasks
[root@vikas ~]# top -u root
top -p 25714
top -n 2 -p 25714
top -b
[top 10 processes]
top -d 1 | head -n 17 | tail -n 11

d-delay p-pid n-iterations u-user

[root@vikas ~]# top -d 1 -n 1 | grep firefox |awk {'print $11 "\t" $13'}
30.2 firefox-bin
[root@vikas ~]#

No comments:

Post a Comment