I'm attempting to debug an application on Ubuntu - I need to listen to file open attempts (even for files that don't exist).

FileMon is available on Windows - what's on Ubuntu's utility belt?

Thanks!

Ashley

link|improve this question

58% accept rate
feedback

5 Answers

up vote 5 down vote accepted

You're looking for strace. Have a look here: https://wiki.ubuntu.com/Strace

link|improve this answer
Thanks Evan! - I'll have a crack tonight. – chickeninabiscuit Jul 7 '09 at 3:49
feedback

It depends on what you want:

  • In the large, you want to look at inotify to see all file accesses that any process makes.

  • In the small, strace will let you watch the syscalls a particular process makes. Strace is pretty awesome. You can trace a process's calls to 'open' by doing strace -f -eopen $cmd, for instance. The man page has full details on syntax, of course.

link|improve this answer
Thanks pjz. To be very specific - i'm having some trouble getting started with Ogre3d on Ubuntu. My test application seems to be looking for some .cfg files during start-up. I want to listen to all attempts to open files so i can ensure the correct files are available and have the correct permissions. – chickeninabiscuit Jul 7 '09 at 3:59
strace -e open ./app – Justin Jan 23 '10 at 0:32
feedback

strace in front of an starting application is good to watch what the app is doing.
lsof is nice to see which files an already running app is using.

BTW:
lsof -ni:22 shows which process is using Port 22.

link|improve this answer
feedback

SGI has a tool that you might want to try: http://oss.sgi.com/projects/fam/

link|improve this answer
2  
under linux fam is history. Really use inotify nowadays – ThorstenS Jul 7 '09 at 10:45
feedback

This calls for help by Mortadelo. http://gitorious.org/mortadelo

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.