Skip to content

Instantly share code, notes, and snippets.

@letsspeak
Last active December 15, 2015 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save letsspeak/5274875 to your computer and use it in GitHub Desktop.
Save letsspeak/5274875 to your computer and use it in GitHub Desktop.
centos memory usage one liner
// memory usage percent (integral)
free | awk 'NR==2' | awk '{print int($3/$2*100)}'
// actual memory usage (integral)
// http://open-groove.net/linux-command/free/
free | awk 'NR==2' | awk '{print int(($3-($6+$7))/$2*100)}'
// swap memory usage percent (integral)
free | awk 'NR==4' | awk '{print int($3/$2*100)}'
// total memory usage percent (integral)
free -t | awk 'NR==5' | awk '{print int($3/$2*100)}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment