Quantcast
Channel: List the files accessed by a program - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 8

Answer by Tomi Ollila for List the files accessed by a program

$
0
0

I tried that tracefile. For me it gave much less matches than my own strace ... | sed ... | sort -u. I even added -s256 to strace(1) command line but it did not help much...

Then I tried that loggedfs. First it failed since I did not have read/write access to the directory I tried to log with it. After doing chmod 755 temporarily I did get some hits...

But, for me, doing the following seems to work best:

inotifywait -m -r -e OPEN /path/to/traced/directory

And then postprocess the output after running the process of interest.

This doesn't catch the files process access outsice of thetraced directory nor this doesn't know whether some otherprocess accessed the same directory tree, but in many casesthis is good enough tool to get the job done.

EDIT: inotifywait does not catch symlink access (just the targetsafter symlinks resolved). I was hit by this when I archived librariesaccessed by a program for future use. Used some extra perl glob hackeryto pick the symlinks along the notified libraries to get the jobdone in that one particular case.

EDIT2: at least when inotifying files and symlinks themselves from inotifywait command line (e.g. inotifywait -m file symlink or inotifywait symlink file) output will show access to which one is first in command line (regardless which, file of symlink is accessed). inotifywait does not support IN_DONT_FOLLOW -- which, whenI tried programmatically just makes one see access to file (which may,or may not, be what one expects...) regardless of order in command line


Viewing all articles
Browse latest Browse all 8

Trending Articles