Count how many file descriptors are being used by every process of a certain name

here’s a neat little command:

ps -ae | grep <process_name> | perl -lane ‘print $F[0]’ | while read filename; do ls /proc/$filename/fd; done | wc -w

just replace process_name by httpd for example and it’ll tell you how many file descriptions are in use by all the processes with http in them.

Leave a Reply

Your email address will not be published. Required fields are marked *