Posted By

Jaymoon on 01/06/08


Tagged

memory available ram total used


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Jaymoon


Memory Stats


 / Published in: Bash
 

This script will show you the total amount of RAM on your UNIX machine, the amount in use, and the amount available. All in MB.

$ apt-get install nano $ nano /usr/bin/RAM

Copy and paste snippet. CTRL+X in nano to exit, and be sure to save your file.

$ chmod 777 /usr/bin/RAM $ RAM

$ ######################### # Memory Stats: # #########################

 Total......: 464 MB   
 In Use.....: 197 MB   
 Available..: 267 MB   

=========================

  1. #!/bin/bash
  2. bean=`cat /proc/user_beancounters`
  3. guar=`echo "$bean" | grep vmguar | awk '{ print $4;}'`
  4. priv=`echo "$bean" | grep privvm | awk '{ print $2;}'`
  5. let totl=guar/256
  6. let used=priv/256
  7. let free=$totl-$used
  8. echo " "
  9. echo " ######################### "
  10. echo " # Memory Stats: # "
  11. echo " ######################### "
  12. echo " "
  13. echo " Total......: $totl MB "
  14. echo " In Use.....: $used MB "
  15. echo " Available..: $free MB "
  16. echo " ========================= "
  17. echo " "

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: ganu on January 7, 2008

if you are in your debian box , change this line bean=cat /proc/user_beancounters to bean=cat /proc/meminfo

You need to login to post a comment.