Skip to content

Instantly share code, notes, and snippets.

@alkesh
Created January 10, 2011 13:01
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 alkesh/772746 to your computer and use it in GitHub Desktop.
Save alkesh/772746 to your computer and use it in GitHub Desktop.
Find total memory usage for matching processes
#!/usr/bin/env ruby
command = %(ps aux| awk '/.*#{ARGV[0]}.*/{total+=$6}END{print total/1024, "Mb"}')
total_mem = `#{command}`
puts total_mem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment