Skip to content

Instantly share code, notes, and snippets.

View daniel-santos's full-sized avatar

Daniel Santos daniel-santos

  • Texas, USA, Earth, Sol, Milky Way, Laniakea
View GitHub Profile
@daniel-santos
daniel-santos / procmem
Last active September 24, 2025 20:34
Show total memory and swap for all processes matching a pattern, e.g. `procmem firefox`
#!/bin/bash
pat="$1"
pids=$(
find /proc/* -maxdepth 1 -name exe -printf "%p\t%l\n" 2>&- \
| grep "$pat" \
| perl -pe 's|^/proc/(\d+)/exe.*$|$1,|g;' \
| tr -d \\n
)