How to track processes that access a specific file?

I know that there is a fuser command that lists the components of the processes, but how do you constantly monitor which process accessed the file? (think of behavior similar to the tail name -f)

tell me there is a process that writes to a file and frees the descriptor at a certain interval, so it is difficult to catch this process using the fuser.

+5
source share
2 answers

You can monitor the execution of commands at periodic intervals. Watch also supports a difference flag to highlight differences in successive runs.

watch -n 5  'fuser file_name'
+1
source

You can use inotifywatch, assuming you are on Linux.

60 , .

inotifywatch -v -e access -e modify -t 60 filename

inotifywatch https://github.com/rvoicilas/inotify-tools/wiki

0

All Articles