1ptree(1) User Commands ptree(1)
2
3
4
6 ptree - print process trees
7
9 /usr/bin/ptree [-a] [-c] [-z zone] [pid | user]...
10
11
13 The ptree utility prints the process trees containing the specified
14 pids or users, with child processes indented from their respective par‐
15 ent processes. An argument of all digits is taken to be a process-ID,
16 otherwise it is assumed to be a user login name. The default is all
17 processes.
18
20 The following options are supported:
21
22 -a All. Print all processes, including children of process 0.
23
24
25 -c Contracts. Print process contract memberships in addition to
26 parent-child relationships. See process(4). This option
27 implies the -a option.
28
29
30 -z zone Zones. Print only processes in the specified zone. Each zone
31 ID can be specified as either a zone name or a numerical
32 zone ID.
33
34 This option is only useful when executed in the global zone.
35
36
38 The following operands are supported:
39
40 pid Process-id or a list of process-ids. ptree also accepts
41 /proc/nnn as a process-id, so the shell expansion /proc/* can
42 be used to specify all processes in the system.
43
44
45 user Username or list of usernames. Processes whose effective user
46 IDs match those given are displayed.
47
48
50 Example 1 Using ptree
51
52
53 The following example prints the process tree (including children of
54 process 0) for processes which match the command name ssh:
55
56
57 $ ptree -a `pgrep ssh`
58 1 /sbin/init
59 100909 /usr/lib/ssh/sshd
60 569150 /usr/lib/ssh/sshd
61 569157 /usr/lib/ssh/sshd
62 569159 -ksh
63 569171 bash
64 569173 /bin/ksh
65 569193 bash
66
67
68
70 The following exit values are returned:
71
72 0 Successful operation.
73
74
75 non-zero An error has occurred.
76
77
79 /proc/* process files
80
81
83 See attributes(5) for descriptions of the following attributes:
84
85
86
87
88 ┌─────────────────────────────┬─────────────────────────────┐
89 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
90 ├─────────────────────────────┼─────────────────────────────┤
91 │Availability │SUNWesu │
92 ├─────────────────────────────┼─────────────────────────────┤
93 │Interface Stability │See below. │
94 └─────────────────────────────┴─────────────────────────────┘
95
96
97 The human readable output is Unstable. The options are Evolving.
98
100 gcore(1), ldd(1), pargs(1), pgrep(1), pkill(1), plimit(1), pmap(1),
101 preap(1), proc(1), ps(1), ppgsz(1), pwd(1), rlogin(1), time(1),
102 truss(1), wait(1), fcntl(2), fstat(2), setuid(2), dlopen(3C), sig‐
103 nal.h(3HEAD), core(4), proc(4), process(4), attributes(5), zones(5)
104
105
106
107SunOS 5.11 11 Oct 2005 ptree(1)