Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I know I can use lsof path/to/file to see which processes currently have a given file open.

Is there a top-like command I can use to continuously monitor which processes have a given file open?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Instead of lsof, I would suggest using fuser(1), especially since you say you want to watch for processes, and not ports or users or anything else.

share|improve this answer

Take a look the +|-r option for repeat mode:

$ lsof -r 1 path/to/file

You can also use the watch command:

$ watch -n 1 'lsof path/to/file'
share|improve this answer

Your Answer

 
discard

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.