Skip to content

Instantly share code, notes, and snippets.

@wjlafrance
Created May 3, 2012 20:12
Show Gist options
  • Save wjlafrance/2588950 to your computer and use it in GitHub Desktop.
Save wjlafrance/2588950 to your computer and use it in GitHub Desktop.
Memory usage
total=`sysctl hw.memsize | awk '{print $2}'`
total=`echo $total / 1024 | bc`
physmem=`top -l 1| grep PhysMem: | sed s/M/*1024/g`
#wired=` echo $physmem | awk '{print $2}' | bc`
#active=` echo $physmem | awk '{print $4}' | bc`
#inactive=`echo $physmem | awk '{print $6}' | bc`
used=` echo $physmem | awk '{print $8}' | bc`
free=` echo $physmem | awk '{print $10}' | bc`
echo "$used megabytes used"
echo "$free megabytes free"
echo "$total megabytes total"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment