Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

Thank you.

share|improve this question
up vote 11 down vote accepted

Try the watch command:

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

Watch is nice.

You could use an old school while loop:

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

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

share|improve this answer
works perfectly! Thank you! Just a minor typo, where it reads /prod change to /proc (let not some googler find your answers less worthy because he cant just copy-paste it!) ;) thks! – Frankie Jan 6 '11 at 12:47
sleep itself can be used as condition in while loop, so your example can be written more elegantly like this: while sleep 10; do ls -l /proc/$$/fd; done – ipozgaj Jan 6 '11 at 12:55

You could combine lsofand watch.

For example watch "lsof -p 1234" will give you a list of all open files of pid 1234 every 2 seconds. You could change some parameters to meet your needs.

share|improve this answer

If you want to see each file as it is being opened, you can filter that with strace. For example:

strace -p _pid_of_app_ -e trace=open,close
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.