Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

pstree - display process hierarchy

&pagelevel(4)&pagelevel

pstree outputs a pseudographic overview of all or specific POSIX processes, showing the parent, child, and sibling relationships of the processes.

By default, only the POSIX administrator (superuser) is allowed to execute pstree.

If other users should also be allowed to execute pstree, the POSIX administrator can allow these users to execute "sudo pstree ..." (see sudo, sudoers).

Alternatively, after installing POSIX-BC, the POSIX administrator can assign the S-bit to the command (using: chmod +s /sbin/pstree), which allows all users to execute pstree.


Syntax


pstree[ -p pid]

No option specified

pstree outputs the entire process tree, which shows the parent, child, and sibling relationships of the processes.


-p pid

Only those parts of the process tree are output that contain the process with the process number pid, its parent processes, or its child processes.

Output

Each output line consists of the following parts:

prefix

A pseudo-graphic string that visualizes parent, child, and sibling relationships.

PID

Process ID: A 5-digit decimal number with leading zeros.

TSN

BS2000 TSN of the process: A 4-digit alphanumeric string that begins with a number for user tasks and with a letter for system tasks.

UID

Username of the process: An 8-character string, possibly padded with spaces.

CMD

Command (program) that is executed in the process: A variable-length string, as displayed by the command ps -o args.


If the standard output stdout is a terminal, the length of the output line is limited to the window width of the terminal.

Error

pstree: Process with PID n not found

The process with PID n specified by the -p option does not exist (anymore).


pstree: Not superuser

The caller is not the superuser.

Locale

The following environment variables affect the execution of ps:

LANG

Provide a default value for the internationalization variables that are unset or null. If LANG is unset of null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization variables contains an invalid setting, the utility will behave as if none of the variables had been defined.

Example 1

Output of the entire process tree:

# pstree
 +- 00000 HT24 SYSROOT  dssm
 |-+- 00001 15BV SYSROOT  [init]
 : :
 | |--- 00168 15GA SYSROOT  [inetd]
 | |--- 00175 15GH SYSROOT  [cron]
 | |-+- 00194 15G1 SYSROOT  [[sshd]: |opt|TCP-IP-SV|openssh|sbi
 | | |-+- 00907 152Y SYSROOT  [[sshd]: tsos@pts|1]
 | | | `-+- 00911 1522 SYSROOT  [sh]
 | | |   `--- 01457 16KF SYSROOT  [pstree]
 | | `-+- 01320 16GI SYSROOT  [[sshd]: user1@pts|2]
 | |   `--- 01324 16GM USER1    [sh]
 | `--- 01319 16GH SYSROOT  [syslogd]
 |--- 00002 XOQK SYSROOT  pageout
 :
 |--- 00012 XOQU SYSROOT  xti.sockd
 `--- 00013 XOQV SYSROOT  timerd

Example 2

Output of the parts of the process tree that contain the process with process ID 121, its parent processes, or its child processes:

# pstree -p 121
 +- 00000 HT24 SYSROOT  dssm
 `-+- 00001 16SV SYSROOT  [init]
   `-+- 00121 16VY SYSROOT  [nfsd]
     |--- 00124 16V1 SYSROOT  [nfsd]
     |--- 00126 16V3 SYSROOT  [nfsd]
     `--- 00127 16V4 SYSROOT  [nfsd]

See also

ps, top