Resolved before asked: cat /proc/1111/status | grep PPid
|
|
Command line:
Function:
Script:
If no PID is supplied to the function or the script, they default to show the PPID of the current process. |
|||||||||
|
|
Parent pid is in shell variable PPID, so
|
|||||
|
|
This is one of those things I learn, forget, relearn, repeat. But it's useful. The pstree command's āsā flag shows a tree with a leaf at N:
|
|||
|
|
|
Read /proc/$PID/status. Can be easily scripted:
#!/bin/sh
P=$1
if [ -z "$P" ]; then
read P
fi
cat /proc/"$P"/status | grep PPid: | grep -o "[0-9]*"
|
|||
|
Run And while So by entering the letter before the parameter you can enable or disable it. For parent process ID you have to enter B and then press Enter, it'll display the PPID in top output. |
|||||
|