CHAPTER 8Shell Process Tree

The process-tree script presented in this chapter does exactly what its name suggests: it prints out the names of some or all of the currently running processes that are present in the process table, displaying the parent/child relationships that exist among them in the form of a visual tree. There is an implementation of this functionality on some versions of Solaris (ptree) and on all flavors of Linux (pstree). These have proved very valuable to me for finding the root of a process group quickly, especially when that part of the process tree needs to be shut down.

There are some UNIX-based operating systems that don't have this functionality, such as HP-UX; hence the reason for this script. Along the way, this script ...

Get Expert Shell Scripting now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.