What command to see which file is opened by a program during execution?

Steven R. Ringwald asric at asric.com
Fri May 27 11:24:53 UTC 2005


VJ wrote:

>Hi,
>   I forgot this command which could be used to see what files are
>accessed by a program during it's execution time, the syntax was like
>following
>
>command_i_forgot program_i_want_to_monitor
>
>and it used to print all files/shared libraries a program used to load
>while program was running.
>
>Can anybody tell what command is that?
>

well, to see what files are open, you could use lsof, but the argument 
would be the file you are interested in. Lsof by itself will show all 
open files, and you could grep it. If you know the process number of the 
program, lsof -p <process num> should give you the open files for that 
process.

Steve




More information about the fedora-list mailing list