[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: see what files are touched by a program



On Tue, 2010-10-19 at 21:48 -0400, Karl Vogel wrote: 
> 
>    "strace" will do what you want, but it's awkward to use if this app is
>    being called by something else.  The easiest way might be to use a
>    small script as a placeholder for the application:
> 
>      you% mv /path/to/app /path/to/app.bin
> 
>      you% cat /path/to/app
>      #!/bin/sh
>      strace -e trace=open -o /tmp/x$$ /path/to/app.bin ${1+"$@"}
>      grep -v RDONLY /tmp/x$$ > /tmp/app$$
>      exec rm /tmp/x$$
>      exit 1
> 
>    Running this using "vim" for the command and "stuff" for the filename
>    gave me this trace in /tmp/app21656:
> 
>      open("/tmp/stuff.swp", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = 4
>      open("4913", O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE, 0100644) = 3
>      open("stuff", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0644) = 3
>      open("/me/.viminfo.tmp", O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = 5
> 

Seems excellent , thanks.

Kind regards,
Steven



Reply to: