Last active
November 21, 2016 08:47
-
-
Save spot62/4610c60175082c90f3c7fa5b5a816e69 to your computer and use it in GitHub Desktop.
Sort proccess by memory used
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 | |
#sort | |
ps -eo size,pid,user,command | awk '{ hr=$1/1024 ; printf("%13.6f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | sort | |
# memory statistics | |
cat /proc/meminfo | |
# drop cache (but not for VPS) | |
sync | |
echo 1 > /proc/sys/vm/drop_caches | |
echo 2 > /proc/sys/vm/drop_caches | |
echo 3 > /proc/sys/vm/drop_caches | |
# clear swap | |
swapoff -a | |
swapon -a | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment