Skip to content

Instantly share code, notes, and snippets.

@bluebear94
Created April 24, 2018 05:48
Show Gist options
  • Save bluebear94/65d5ab24ce9ffb35f14815389a4f4253 to your computer and use it in GitHub Desktop.
Save bluebear94/65d5ab24ce9ffb35f14815389a4f4253 to your computer and use it in GitHub Desktop.
Sum memory usage of all processes that match a given name
#!/bin/bash
ps -u $USER -o rss=,cmd= | grep -E $1'([[:space:]]|$)' | awk '{ sum += $1 } END { print sum }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment