Created
October 24, 2012 12:35
-
-
Save vpereira/3945833 to your computer and use it in GitHub Desktop.
Petzer.py
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 python | |
# run it as root | |
# as result you get list pid -> number of fds | |
import os | |
for pid in [pid for pid in os.listdir('/proc') if pid.isdigit()]: | |
print pid,len([name for name in os.listdir(os.path.join('/proc',pid,'fd')) if not os.path.isdir(name)]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment