Created
July 21, 2015 20:17
-
-
Save artemeff/5945c7c4e0f2744ad4c4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function ram | |
set -l sum 0 | |
set -l app $argv[1] | |
if [ -z $app ] | |
echo "First argument - pattern to grep from processes" | |
else | |
for i in (ps aux | grep -i "$app" | grep -v "grep" | awk '{print $6}') | |
set sum (math $sum + $i) | |
end | |
if [ $sum != "0" ] | |
echo "$app uses $sum MBs of RAM." | |
else | |
echo "There are no processes with pattern '$app' are running." | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment