Monitor open process files on linux (real-time)

filesmonitoringperformance-monitoringprocess

The files opened by XYZ process can be found with the command

ls -l /proc/PID/fd

Is there anyway that can be done in a more interactive way like tail auto-refreshing every x seconds?

Best Answer

Try the watch command:

watch -n 10 ls -l /proc/$$/fd

Watch is nice.

You could use an old school while loop:

while :
do
 ls -l /proc/$$/fd
 sleep 10
done

watch is in the procps package on debian based systems and the procps rpm on RedHat derived systems.