Skip to content

Instantly share code, notes, and snippets.

@brianwhigham
Created May 27, 2016 21:40
Show Gist options
  • Save brianwhigham/65c42a6f4a6bbad0eee89fd1ddd631fb to your computer and use it in GitHub Desktop.
Save brianwhigham/65c42a6f4a6bbad0eee89fd1ddd631fb to your computer and use it in GitHub Desktop.
show amount of used RAM with bash and awk
#!/bin/sh
free -m | awk 'NR==2{ram=$2; getline; used=$3; printf "%.0f\n", 100-(ram-used)/ram*100 }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment