Tuesday 21 July 2009

HPUX equivalent of ptree

I sorely miss the proc tools found on Solaris and Linux each time I have to deal with HP-UX - the tools pfiles, ptree, pkill, pgrep are just too valuable to go without. Here is just one hack I found that can effectively do the same function as ptree (well, sort of):

bash-3.00# UNIX95=1 ps -Hef
The output of all processes on the system will grouped by parent process id's with children processes nicely indented below their parents. Even though it is not even nearly as good as using a genuine ptree utility, since you may have to brose the longish list to find all the parents of the process you're interested in, it still has definite usefulness. Please remember not to export the UNIX95 variable since if exported this variable will effect the way other programs you may start from command line will behave after that point.

No comments: