I want to get a list of all child process IDs for a given parent process ID (6330 qemu
) to use in a bash
script.
I can see them in htop
, for instance:
Top search results include:
# pgrep -P 6330
(no output)
# ps --ppid 6330
PID TTY TIME CMD
# pstree -p 6330
qemu(6330)-+-{qemu}(6332)
|-{qemu}(6333)
|-{qemu}(6340)
|-{qemu}(6342)
|-{qemu}(6343)
`-{qemu}(6344)
...output of these are the same if run as root
or as the user that owns qemu
.
The pstree
output is workable as a last resort, but I would prefer not parsing it if I can help it.
Also... ps aux | grep 6332
and pgrep 6332
doesn't yield anything... so that's a little puzzling too.
This should be easy right?
I appreciate your time.