Skip to content

Instantly share code, notes, and snippets.

@langmi
Created July 23, 2012 21:39
Show Gist options
  • Save langmi/3166394 to your computer and use it in GitHub Desktop.
Save langmi/3166394 to your computer and use it in GitHub Desktop.
shows free and available vps memory on a shared server
#!/bin/bash
# von/from http://devnulled.com/content/2007/06/how-to-display-linux-vps-memory-usage/
bean=`cat /proc/user_beancounters`
guar=`echo "$bean" | grep vmguar | awk '{ print $4;}'`
burst=`echo "$bean" | grep privvm | awk '{ print $5;}'`
priv=`echo "$bean" | grep privvm | awk '{ print $2;}'`
let total=guar/256
let used=priv/256
let burst=burst/256
echo "VPS memory usage:"
echo "Used: $used MB"
echo "Total: $total MB"
echo "Burstable to: $burst MB"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment