Last active
August 29, 2015 14:21
-
-
Save estahn/a901c5aea86525ff1766 to your computer and use it in GitHub Desktop.
Number of open files per process
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
#!/bin/sh | |
processes=$(lsof | cut -f1 -d" " | sort | uniq | xargs -n1 -I% sh -c 'echo % `pidof % | sed -e "s/ /,/g"`' | cut -d" " -f1 -s) | |
for process in $processes; do | |
echo $process $(pidof $process | sed -e "s/ /,/g" | xargs -I% -n1 sh -c 'lsof -a -p % | wc -l') | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment