Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #!/bin/sh
  2. /usr/bin/vm_stat | sed 's/\.//' | awk '
  3. /free/ {FREE_BLOCKS = $3}
  4. /inactive/ {INACTIVE_BLOCKS = $3}
  5. /speculative/ {SPECULATIVE_BLOCKS = $3}
  6. /wired/ {WIRED_BLOCKS = $4}
  7.  
  8. END {
  9. printf "Free: %s\n", ((FREE_BLOCKS+SPECULATIVE_BLOCKS)*4096/1048576)
  10. printf "Inactive: %s\n", ((INACTIVE_BLOCKS)*4096/1048576)
  11. printf "Total Free: %s\n" ((FREE_BLOCKS+SPECULATIVE_BLOCKS+INACTIVE_BLOCKS)*4096/1048576)
  12. printf "Wired: %s\n", ((WIRED_BLOCKS)*4096/1048576)
  13. printf "Active: %s\n", (4096-((FREE_BLOCKS+SPECULATIVE_BLOCKS+INACTIVE_BLOCKS+WIRED_BLOCKS)*4096/1048576))
  14. printf "Total Used: %s\n", (((INACTIVE_BLOCKS+WIRED_BLOCKS)*4096/1048576)+(4096-((FREE_BLOCKS+SPECULATIVE_BLOCKS+INACTIVE_BLOCKS+WIRED_BLOCKS)*4096/1048576)))
  15. }'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement