Created
December 2, 2015 10:46
-
-
Save hudsantos/7fec7d9c34cc472b7f98 to your computer and use it in GitHub Desktop.
Simple ShellScript to free your memory and cache on Linux systems
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
before=`free -m| grep -A1 free|tail -1 | awk '{print $4}'` | |
echo "free memory before: $before Mbytes" | |
echo "cleaning mem!" | |
sync; echo 3 > /proc/sys/vm/drop_caches | |
after=`free -m| grep -A1 free|tail -1 | awk '{print $4}'` | |
gift=`expr $after - $before` | |
echo "free memory after: $after Mbytes (gift of $gift Mbytes)" | |
echo "done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment