'shell-scripting-program show the process hierarchy of that specified process till the parent process whose process id is 1
Write a shell program to enter the process id of a particular process and show the process hierarchy of that specified process till the parent process whose process id is 1.
Solution 1:[1]
#!/bin/bash
(which pstree > /dev/null || sudo apt-get install psmisc -y) && pstree -ps "$1"
-p
: --show-pids-s
: --show-parents
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Victor Lee |