Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

One of the programs in my cgi-bin folder is misbehaving. It's a compiled binary for which I do not have the source code. I would like to set up some kind of monitor to gather a list of the files that the program opens when it gets executed and dump that into a text file.

It looks like lsof might have that info, but since the CGI program is transient and typically finishes execution in under a second, it's not really practical to run lsof from the command line at the same time. For that matter, I'm not even sure if the CGI program would show up as itself or if the activity would be registered to the httpd process.

The server is running Red Hat Enterprise Linux 6.4 with Apache 2.2.15, and I have root access.


share|improve this question
up vote 1 down vote accepted

You can use strace to find out what your cgi-bin program does. See this question on StackOverflow about how to use strace.

share|improve this answer
This did the trick. I was able to write a wrapper for the binary that ran it through strace and dumped the output to /tmp. Thanks! – Will Martin Apr 17 '13 at 18:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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