Skip to content

Instantly share code, notes, and snippets.

@iAnatoly
Last active November 30, 2021 18:47
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 iAnatoly/708464e9b3cd422c671a9cf8fe564200 to your computer and use it in GitHub Desktop.
Save iAnatoly/708464e9b3cd422c671a9cf8fe564200 to your computer and use it in GitHub Desktop.
print out the swap usage by process
for proc in /proc/*; do cat $proc/smaps 2>/dev/null | awk -v proc="${proc}" '/Swap/{swap+=$2/1024}END{if (swap>1) { "readlink "proc"/exe"|getline c; print int(swap+0.5), "\tMB\t", c }}'; done | sort -n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment