(TLDR Doug O'Neal's
strace -f -e execve ./myprogram solved me problem)
I start a program on the command line. The executing program spawns processes. I would like to see or log the names of all processes spawned by the program.
top with forest view V:
$ top -c -d 1
Only the parent program is briefly visible. I suspect the refresh rate is too slow to show the child processes.
I've tried to filter by
COMMAND=myprogram but this most probably filters out the child processes.
The parent program spawns processes but I am not sure if top's forest view will show those new processes indented under the original process or independently. I'm not sure if a spawned process can be independent of the parent.
I tried this answer with the sleep removed.
#!/bin/bash mkdir -p "$HOME/ps_logs" while true; do ps faux > "$HOME/ps_logs/ps_$(date +%Y-%m-%d_%H:%M:%S).log" done
I filtered the output with:
grep -rnw './' -e 'myprogam'
All the files only contain
myprogram. So how do I know if
myprogram even spawns any processes?