Apr 21, 2018

Find Sum of RSS memory in ps command in linux/unix

Find Sum of RSS memory in ps command in linux/unix
  • In KB
    • ps aux | awk 'BEGIN {sum=0} {sum +=$6} END {print sum}'
  • In MB
    • ps aux | awk 'BEGIN {sum=0} {sum +=$6} END {print sum/1024}'
  • In GB
    • ps aux | awk 'BEGIN {sum=0} {sum +=$6} END {print sum/1024/1024}'

How to find free memory available
  • cat /proc/meminfo
  • using free command
    • In KB
      • free
    • In MB
      • free -m
    • In GB
      • free -g 
I observed
  • Sum of RSS memory in ps less than memory actually used
  • Total used memory a lot higher than sum of RSS
  • Reason
    • The Linux kernel will use available memory for disk caching

No comments:

Post a Comment