Felix' blog

search
feeds
links
Thursday Mar 26, 2009

count files open on a solaris machine without lsof

If there is no lsof installed and you want to know how many files are currently open you could use this script:

#!/bin/bash

count=0

for i in `ls /proc`; do
if [ -d /proc/$i/fd ]; then
add=$( ls /proc/$i/fd | wc -w )
else
add=0
fi
let "count=count+add"
done
echo $count

Comments:

Post a Comment:
Comments are closed for this entry.