Last active
August 8, 2023 13:50
-
-
Save wamonite/333d176c1af1eed79302d6ef3156f0b7 to your computer and use it in GitHub Desktop.
find one-liner to list processes by their oom_score
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
find /proc/ -maxdepth 2 -name oom_score -exec bash -c 'pid=$(cut -d '/' -f 3 <<< $1) ; echo -n "$pid " ; cat /proc/$pid/oom_score | tr "\n" " " ; head -n 1 /proc/$pid/cmdline | tr "\000" " " ; echo' func {} \; 2> /dev/null | sort -k2nr -k1nr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment