How do I get process tree traces/logs for a process in Linux?
I want to know which executables the script started and in what order (and recursively track those executables).
For example, let’s say I have a bash script here called abc.sh:
#!/bin/bash ls gcc
I want to run this script with the “trace/log command” and get a result like this:
abc.sh -- ls |-- gcc -- cpp -- cc1 ... etc.
This indicates that abc.sh called ls and gcc. GCC calls cpp and then cc1.
Is this possible? What should I do? A TreeView like the above would be nice, but a simpler View would also do.
Note that I don’t want a current snapshot of the process tree. Instead, I want to generate a trace or log of the process. Timing notes are also useful.
You can try to analyze the output
of the strace command.
In particular, you will be interested in something similar
strace -f -tt -e trace=execve ./abc.sh