View Full Version : [ubuntu] how to monitor which files were opened during execution of a process?

October 14th, 2009, 11:45 PM
Thank you for reading my question.
I need to findout which files were accessed during the execution of a program. Can you please let me know how to do it?

I can not use system monitor because the process is very short lived and almost nothing is showed in system monitor during he execution.


October 14th, 2009, 11:56 PM
On the command line:

strace -e trace=file -o some_file.log some_program

some_file.log contains a list of a file-related system calls made during the execution of some_program

October 15th, 2009, 12:14 AM
Thank you for the reply.
Can you please let me know whether the command logs possible files that are opened by a program invoked by some_program?

For example if some_program is an script which invokes some other script files which will do the actual job?


October 15th, 2009, 12:22 AM
Use -f with strace to trace the child processes, too:

strace -f -e trace=file -o some_file.log some_program