pstree is a relatively portable awk script that rearranges the output of "ps" into a parent-child tree. pstree gets its name from several other common utilities that do something similar. It is known to work with Cygwin, FreeBSD, IRIX, Linux, NetBSD, OpenBSD, and Solaris. It should also be easy to add other platforms. If you do add another platform, please e-mail me a patch.
To run it, you will need the "pstree" and "pstree.awk" files below. Make sure you install them in the same directory.