Last active
September 4, 2017 03:41
-
-
Save cookie-ag/6a6eb5bd61d86ca17f8d673ac300bad2 to your computer and use it in GitHub Desktop.
Memory tools for Linux
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 | |
ps -eo rss,pid,user,command | sort -rn | head -10 | awk '{ hr[1024**2]="GB"; hr[1024]="MB"; | |
for (x=1024**3; x>=1024; x/=1024) { | |
if ($1>=x) { printf ("%-6.2f %s ", $1/x, hr[x]); break } | |
} } { printf ("%-6s %-10s ", $2, $3) } | |
{ for ( x=4 ; x<=NF ; x++ ) { printf ("%s ",$x) } print ("\n") } | |
' |
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/bash | |
echo "echo 2 > /proc/sys/vm/drop_caches" | |
# Give permission to this file before execution using "chmod 755 clearRAM_**.sh" | |
# what is page cache, dentries and inodes ?: https://stackoverflow.com/questions/29870068/what-are-pagecache-dentries-inodes |
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/bash | |
echo "echo 1 > /proc/sys/vm/drop_caches" | |
# Give permission to this file before execution using "chmod 755 clearRAM_**.sh" | |
# what is page cache, dentries and inodes ?: https://stackoverflow.com/questions/29870068/what-are-pagecache-dentries-inodes |
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/bash | |
echo "echo 3 > /proc/sys/vm/drop_caches" | |
# Give permission to this file before execution using "chmod 755 clearRAM_**.sh" | |
# what is page cache, dentries and inodes ?: https://stackoverflow.com/questions/29870068/what-are-pagecache-dentries-inodes |
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/bash | |
echo "swapoff -a && swapon -a" | |
# Give permission to this file before execution using "chmod 755 clearcache.sh" | |
# what is Swap Space in linux? : https://www.centos.org/docs/5/html/5.2/Deployment_Guide/s1-swap-what-is.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment