How to find which processes were written to a file on Linux

Is there any way to find out which process was written to file before file. I am having a problem where several processes seem to be writing to a file. I know one of the processes, but I donโ€™t know who else writes to the file. I'm on linux / ubuntu. Is there a way that the OS supports which processes were written to the specified file

+3
source share
2 answers

Create a small monitoring process that will periodically register who is currently accessing the file.

You can write a small script using the fuser. Is a short example here (for improvement)

#!/bin/bash

log=~/file-access.log

while true
do
  fuser your_file >> $log
  sleep 0.2s
done

, , .

+5

, , , .

, inotify , , .

0

All Articles