Created
May 25, 2020 10:55
-
-
Save mtfelian/4a2de905e2db45ca40916918e44e6ed7 to your computer and use it in GitHub Desktop.
Displays top10 processes by count of open files
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
cd /proc | |
for pid in [0-9]* | |
do | |
echo "PID = $pid with $(ls /proc/$pid/fd/ | wc -l) file descriptors" | |
done | sort -rn -k5 | head | while read -r _ _ pid _ fdcount _ | |
do | |
command=$(ps -o cmd -p "$pid" -hc) | |
printf "pid = %5d with %4d fds: %s\n" "$pid" "$fdcount" "$command" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment