You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varpidtree=require('pidtree')// Get childs of current processpidtree(process.pid,function(err,pids){console.log(pids)// => []})// Include the given pid in the result arraypidtree(process.pid,{root: true},function(err,pids){console.log(pids)// => [727]})// Get all the processes of the System (-1 is a special value of this package)pidtree(-1,function(err,pids){console.log(pids)// => [530, 42, ..., 41241]})// Include PPID in the resultspidtree(1,{advanced: true},function(err,pids){console.log(pids)// => [{ppid: 1, pid: 530}, {ppid: 1, pid: 42}, ..., {ppid: 1, pid: 41241}]})// If no callback is given it returns a promise insteadconstpids=awaitpidtree(1)console.log(pids)// => [141, 42, ..., 15242]
Compatibility
Linux
FreeBSD
NetBSD
SunOS
macOS
Win
AIX
β
β
β
β
β
β
β
β = Working
β = Not tested but should work
Please if your platform is not supported file an issue.
CLI
Show a tree of the processes inside your system inside your terminal.
npx pidtree $PPID
Just replace $PPID with one of the pids inside your system.
Or don't pass anything if you want all the pids inside your system.
npx pidtree
To display the output as a list, similar to the one produced from pgrep -P $PID,
pass the --list flag.