linux - Listing ancestors and descendents of process ID -


i'm creating program takes process id , lists name network connections.

echo '===========================' echo 'please enter process id: ' read pidn ps -p $pidn|awk '{print $1, $4}' echo '===========================' echo 'here network connections for: ' $pidn sudo netstat -p|grep $pidn  echo '===========================' echo 'the parent process id: ' ps -p ${pidn:-$$} -o ppid= 

the next step take id entered user , find 3 parent processes of id , 3 child processes of id.

i presume need create loop recursively parents , child processes i'm not sure how done.

can direct me towards should start or how done.

many thanks!


Comments

Popular posts from this blog

php - Embed BBCode within itself not working -

three.js - how to load gltf in three JS -

sql server - T-SQL: Access DB objects in same schema without qualifying? -