Skip to content

Instantly share code, notes, and snippets.

@vpereira
Created October 24, 2012 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vpereira/3945833 to your computer and use it in GitHub Desktop.
Save vpereira/3945833 to your computer and use it in GitHub Desktop.
Petzer.py
#!/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