Can some one help me change a script of mine?
I had this working perfect under leopard but when I upgraded to snow leopard I couldn't get the cpu usage to work.
Code:echo CPU Usage top -l 1| awk '/CPU usage/ {print $8, $9}' top -l 1| awk '/CPU usage/ {print $10, $11}' top -l 1| awk '/CPU usage/ {print $12, $13}' echo"" echo Memory Usage &top -l 1 | awk '/PhysMem/ {print "Used: " $8}' top -l 1 | awk '/PhysMem/ {print "Free: " $10}' echo"" echo Macintosh HD df -h | grep "disk1s2" | awk '{print "Total Space: " $2}' df -h | grep "disk1s2" | awk '{print "Free Space: " $4}' echo " " echo Trash Size du -sh ~/.Trash/ | awk '{print $1}'
Also, I would like to add a
"Inactive memory" and
"Total free memory" ( free+inactive)
I tried various things but couldn't get them working...
Thanks.
I figured out how to get the inactive memory, now just need to figure out how to add inactive + free together and get a total free memory? Any one have any ideas?
Here is the code to show inactive memory (along with used and free) in case any one wanted it.
Code:
top -l 1 | awk '/PhysMem/ {print "Used: " $8 " Free: " $8 " Inactive: "$6}'