PT

Section: Misc. Reference Manual Pages (1L)
Updated: local
Index Return to Main Contents
 

NAME

pt - postprocess ps output into hierarchical form  

SYNOPSIS

pt [ -a ] [ -w ] [ ps args ] [ pid list ]  

DESCRIPTION

The pt program is a perl front end to ps that displays a ps listing with processes arranged in a tree format. That is, processes are listed under their parents, indented to the right.

For example:

USER       PID   TTY    TIME COMMAND
tchrist   9341    p3    1:02 -tcsh
tchrist  10423    p3    0:11   vi pt.pl
tchrist  27045    p3    0:00   vi pt
tchrist  28371    p3    0:04   trn
tchrist  29366    p3    0:00     /bin/sh -c Pnews -h /mnt/tchris
tchrist  29367    p3    0:00       sh /usr/local/bin/Pnews -h /m
tchrist  29394    p3    0:00         perl sigspell
tchrist  29395    p3    0:00           vi /mnt/tchrist/.article 
tchrist  29080    p3    0:01   vi pt.1
tchrist  29831    p3    0:00     sh -c ./pt
tchrist  29833    p3    0:00       perl ./pt
tchrist  29834    p3    0:00         /bin/ps xlww
tchrist   9361    p3    0:08 monthd -i5
tchrist   9500    pb    0:30 -tcsh
tchrist  23345    pb    0:18   perl plum
tchrist  29726    pb    0:00     perl now-what
tchrist  29729    pb    0:00       perl sigspell
tchrist  29734    pb    0:00         vi /mnt/tchrist/Mail/drafts
tchrist   9522    p3   23:59 perl newsclip 07/02/92 09:15
tchrist   9527    p3    0:07   perl pmeter 
tchrist  19660    q9    0:47 perl sigrand

The first listed process is the shell, and all those indented under it are its direct children. Thus Pnews is a child of trn, which itself has several children of its own.

Normally, pt will truncate at the width of your screen. The -w option will allow output as wide as ps returns.

To list all processes, use the -a option, even if your system expects to pass ps something other than an a flag; pt should know to pass the appropriate flag to ps.

You can also pass pt a list of pids to restrict output to those process trees contains those pids. Any processes below the named pids will be listed in full. Those above will be listed only if they are direct ancestors. For example (reading this output in from the editor):

:r!pt $$
USER       PID   TTY    TIME COMMAND
root         0     ?    0:00 swapout
root         1     ?    1:53   init
root      9339     ?    8:26     xterm -display 130.168.190.14:0
tchrist   9341    p3    1:02       -tcsh
tchrist  29080    p3    0:05         vi pt.1
tchrist    731    p3    0:00           sh -c ./pt $$
tchrist    732    p3    0:00             perl ./pt 731
tchrist    733    p3    0:02               /bin/ps axlww

This allows you to trace both parents and children of a given process.  

RETURN VALUE

pt will exit with a value of 1 if it encounteres difficulty parsing the output of ps or if ps should itself exit non-zero.  

ENVIRONMENT

In order to truncate at your current window size, pt will use the TIOCGWINSZ ioctl(2) if supported on your system. Otherwise, it consults your environment for either a COLUMNS variable, or else checks your current TERMCAP variable for a :co: entry.  

FILES

getopts.plperl getopts library  

SEE ALSO

 

NOTES

The pt distribution comes with a Makefile and a Configure script that should be used to properly select what form of ps you're using, paths, etc.  

DIAGNOSTICS

``skipping unparsable line from ps:\n%s ''
This means that ps output a line which pt couldn't make heads or tails of (probably tails).

``ps exited badly! '' ps returned a non-zero exit status.

``couldn't parse getopts.pl: %s ''
``couldn't do getopts.pl: %s ''
``couldn't run getopts.pl: %s ''
All these mean the getopts library couldn't be loaded. An appropriate message should be printed.

``Didn't you run Configure? '' You are running a raw version of pt that hasn't been configured yet.

``can't fork: %s at line %d of pt '' pt was unable to fork a child of itself to run ps with.
 

BUGS

pt is at the mercy of your ps command, and it would appear that very few vendors make any effort to produce output that can be parsed by humans or computers. pt therefore undergoes numerous convolutions to try to demangle braindead ps output. It is not always successful. File a bug report with your vendor is your ps fields ever run together --- it's a real pain.

The -d option prints out debugging information which may help you diagnose difficulties you may be encountering.  

AUTHOR

Tom Christiansen <tchrist@convex.com>, July 2nd, 1992.


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
ENVIRONMENT
FILES
SEE ALSO
NOTES
DIAGNOSTICS
BUGS
AUTHOR

This document was created by man2html, using the manual pages.
Time: 08:45:35 GMT, May 19, 2025