By definition, it is not possible to run a command that adds up open files, as root-owned files are not visible to a normal user (unless they have the required permissions, which would defeat the object).
You'd have to actively defeat root privacy, and add the user to the sudoers file (Solaris > ver 11) to run the mdb command, or add the user to a group that has read access to root-owned files.
See Why file-nr and lsof count on open files differs? for info on file handler count vs listing open "files" - the totals differ, depending on folders counted as files etc.
For Solaris you can count open files by process... or you need to be able to view root files, and then use "lsof":
lsof | wc -l
For individual processes, you can run "pfiles" against the PID. See thegeekdiary for more.
However, perhaps try using ps and then pfiles:
ps -A | awk '{print $1}' | xargs pfiles
Then add up the totals with awk.
I also tried to use find, but it's a mess as it lists sockets etc. too:
find /proc/*/fd/ * -type f | grep -v "Permission denied" | wc -l
kstat -n file_cache
? And perhaps you can look into the 'new'sstore
command which provides access to the stats store. – Lambert Nov 01 '19 at 13:06sar
and use the reports from it. – Andrew Henle Nov 03 '19 at 16:15