printing a children's full tree recursively in bash script

sry for not being familiar with question conventions since im new here.

i want to write a script that prints the full children's tree recursively of a given pid.

i got so far as:

ps h -ef | awk '$3='$input_pid' {print $2}' | sort -n

but this is just for printing the immediate children of the given pid (sorted).

the question is: how can i summon the recursive function for every child-pid of the given pid?

thanks...

0
задан 21 February 2016 в 11:21
1 ответ

попробуйте это

pstree -p parent_process_ID

Если вы хотите, чтобы отображался только pid

pgrep -P parent_process_ID

или более простой и подробный дисплей.

ps auxfww | grep -v grep | grep process_name
1
ответ дан 4 December 2019 в 16:41

Теги

Похожие вопросы