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?
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?
Take a look the
+|-r
option for repeat mode:You can also use the
watch
command: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.