Created
November 15, 2021 15:46
-
-
Save PieterScheffers/dc4c7323aeda538867b1f150b4f8d7ff to your computer and use it in GitHub Desktop.
Find processes with a minimum number of file descriptors
This file contains hidden or 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
minimum=30 | |
for pid in /proc/[0-9]*; do number_fds=$(ls $pid/fd | wc -l); if [ $number_fds -ge $minimum ]; then printf "PID %6d has %4d FDs\n" $(basename $pid) $(ls $pid/fd | wc -l); ps aux | grep $(echo $pid | cut -d/ -f3) | grep -v grep; fi; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment