Find out how many open files by all processes

Find out how many files are currently opened by all processes combined. The /proc filesystem contains these details on a per process basis. The /usr/proc/bin/pfiles tool lists the opened files by a process. A combination of both in a loop should give the results

The steps involve some shell arithmetics. I tend to use the Korn Shell a lot.

for A_PID in `ls /proc`; do
FILES_OPENED=`/usr/proc/bin/pfiles $A_PID 2>/dev/null| grep "ino:" | wc -l`
echo "Opened files = $TOTAL_OPENED"

The Conversation

Follow the reactions below and share your own thoughts.