/ 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
=========================
Expand |
Embed | Plain Text
#!/bin/bash bean=`cat /proc/user_beancounters` guar=`echo "$bean" | grep vmguar | awk '{ print $4;}'` priv=`echo "$bean" | grep privvm | awk '{ print $2;}'` let totl=guar/256 let used=priv/256 let free=$totl-$used echo " " echo " ######################### " echo " # Memory Stats: # " echo " ######################### " echo " " echo " Total......: $totl MB " echo " In Use.....: $used MB " echo " Available..: $free MB " echo " ========================= " echo " "
Comments
Subscribe to comments
You need to login to post a comment.

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