2

Sometimes I wonder how Linux programs achieve certain results knowing that they internally use system calls (system() or exec() in C programs). Given a working binary I wonder if it is possible to know easily which commands where executed. In a concrete example I use the genealogy tool gramps to build a family tree. I assume that it generates certain graphs using graphviz (using command line tools rather than libraries). Now I want to reproduce the same manually on the command line. This task would be simplified a lot if I knew the commands used by gramps. I could download and look at the sources to find out, but I wonder if I can obtain this information more easily using debugging tools such as strace, something like strace gramps 2>/dev/stdout | grep system. Note that I would not like to search the binary using a hex editor unless this can be automated. Looking at the sources directly should be easier in this case.

2
strace -o dumpfile.strace -f -e trace=process $your $app $with $parameters

You find the result in the file dumpfile.strace.

2
  • I tried this. It looks promising, however I find e.g. execve("/usr/bin/dot", ["dot", "-Tpdf", "-o/home/user/temp/r"..., "/tmp/tmp7ebycv.gv"], [/* 91 vars */]) = 0. Obviously the command is abbreviated in the output. It would be important to know the complete command. Is there an option? – highsciguy Feb 23 '14 at 16:28
  • @highsciguy strace -v -s 128 ... – Hauke Laging Feb 23 '14 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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