Skip to content

Instantly share code, notes, and snippets.

@fipar
Last active May 25, 2018 23:10
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 fipar/ffcf4b926930ec56664155adebaf75ee to your computer and use it in GitHub Desktop.
Save fipar/ffcf4b926930ec56664155adebaf75ee to your computer and use it in GitHub Desktop.
Get list of process names using swap in descending order (by swap usage). Assumes swap usage is printed in kb always, which I need to validate.
grep -r VmSwap /proc/[0-9][0-9]*/status 2>/dev/null|sort -k2 -nr | \
while read procentry meminkb; do
pid=$(echo $procentry|awk -F'/' '{print $3}')
echo "$(cat /proc/$pid/comm) ($pid): $meminkb"
done 2>/dev/null |more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment