Skip to content

Instantly share code, notes, and snippets.

@artemeff
Created July 21, 2015 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artemeff/5945c7c4e0f2744ad4c4 to your computer and use it in GitHub Desktop.
Save artemeff/5945c7c4e0f2744ad4c4 to your computer and use it in GitHub Desktop.
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