Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save PieterScheffers/dc4c7323aeda538867b1f150b4f8d7ff to your computer and use it in GitHub Desktop.
Save PieterScheffers/dc4c7323aeda538867b1f150b4f8d7ff to your computer and use it in GitHub Desktop.
Find processes with a minimum number of file descriptors
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