Based on information for a given file test.txt
, I hope to get a pid and its executable path for a process that is operating on that file.
For example, if from the command line someone has run this:
$ cat test.txt
...then I want have something that will give output similar to this:
process 1123 bin/cat is using /home/sam/test.txt
If the file is still open, you can use:
fuser /home/sam/test.txt