Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] List of files opened by a program (continuously)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
loony
Apprentice
Apprentice


Joined: 25 Feb 2004
Posts: 199

PostPosted: Sat Feb 16, 2008 1:34 pm    Post subject: [SOLVED] List of files opened by a program (continuously) Reply with quote

Hello,

I would like to find out which files a program accesses from the beginning of its execution to the end. I only know lsof, but it doesn't collect data continuously like top or so...

Has anybody an idea? Thanks!

loony
_________________
Please vote for this issue of OpenOffice.org (18004): http://qa.openoffice.org/issues/show_bug.cgi?id=18004


Last edited by loony on Sat Feb 16, 2008 1:49 pm; edited 1 time in total
Back to top
View user's profile Send private message
loony
Apprentice
Apprentice


Joined: 25 Feb 2004
Posts: 199

PostPosted: Sat Feb 16, 2008 1:49 pm    Post subject: Reply with quote

Ups, I should have read the f** manual :) lsof allows a continuous monitoring of a process with the -r switch
Code:

lsof -c $APP -r 1

_________________
Please vote for this issue of OpenOffice.org (18004): http://qa.openoffice.org/issues/show_bug.cgi?id=18004
Back to top
View user's profile Send private message
loony
Apprentice
Apprentice


Joined: 25 Feb 2004
Posts: 199

PostPosted: Sat Feb 16, 2008 2:50 pm    Post subject: Reply with quote

loony wrote:
Ups, I should have read the f** manual :) lsof allows a continuous monitoring of a process with the -r switch


Monitoring with inotify (and e.g. pyinotify) would also be possible and it would not be limited to a 1 second delay monitoring like lsof.
_________________
Please vote for this issue of OpenOffice.org (18004): http://qa.openoffice.org/issues/show_bug.cgi?id=18004
Back to top
View user's profile Send private message
mar_rud
n00b
n00b


Joined: 27 Jul 2006
Posts: 72
Location: Poland

PostPosted: Sat Feb 16, 2008 3:18 pm    Post subject: Reply with quote

I looked at this thread just by curiosity and after "man strace" found another solution:
Code:
strace -e trace=open,close program_cmd
Probably it should be easy to write some script/program parsing open/close lines to list only opened files in realtime.
Back to top
View user's profile Send private message
loony
Apprentice
Apprentice


Joined: 25 Feb 2004
Posts: 199

PostPosted: Sat Feb 16, 2008 3:24 pm    Post subject: Reply with quote

mar_rud wrote:
I looked at this thread just by curiosity and after "man strace" found another solution:
Code:
strace -e trace=open,close program_cmd


Cool, maybe better for people without inotify support in kernel. Thanks!
_________________
Please vote for this issue of OpenOffice.org (18004): http://qa.openoffice.org/issues/show_bug.cgi?id=18004
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum