0 Replies Latest reply on Aug 12, 2013 12:49 PM by 745825

    How to find Open Files by a Process Solaris 10




      Hope you are doing well.


      I'm trying to get open files by a process in solaris 10 using "pfiles" with below command:


      pfiles -n `ps | grep -i "data -log"  | grep -v grep | grep -i uatrate | awk '{print $2}'` | wc –l


      When I put this in some shell script like below then this command is not giving any output. Your assistance is required in this. Please guide me so that I can get the Count of Open files by some process.


      I made some script, Its working fine but its giving the output for whole processes:



      let "TOTAL_OPENED=0"

      for A_PID in `ps | grep -i "data -log"  | grep -v grep | grep -i uatrate | awk '{print $1}'`; do

      FILES_OPENED=`/usr/proc/bin/pfiles -n $A_PID 2>/dev/null| grep "ino:" | wc -l`



      echo "Opened files = $TOTAL_OPENED"


      Many Thanks in advance.


      Imran Qasim.