1 '\" te 2 .\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved. 3 .\" Copyright 2019 Joyent, Inc. 4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. 5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. 6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] 7 .TH PTREE 1 "Sep 3, 2019" 8 .SH NAME 9 ptree \- print process trees 10 .SH SYNOPSIS 11 .nf 12 \fB/usr/bin/ptree\fR [\fB-a\fR] [\fB-c\fR] [\fB-s\fR \fIsvc\fR] [\fB-z\fR \fIzone\fR] [\fIpid\fR | \fIuser\fR]... 13 .fi 14 15 .SH DESCRIPTION 16 The \fBptree\fR utility prints the process trees containing the specified 17 \fIpid\fRs or \fIuser\fRs, with child processes indented from their respective 18 parent processes. An argument of all digits is taken to be a process-ID, 19 otherwise it is assumed to be a user login name. The default is all processes. 20 .SH OPTIONS 21 The following options are supported: 22 .sp 23 .ne 2 24 .na 25 \fB\fB-a\fR\fR 26 .ad 27 .RS 11n 28 All. Print all processes, including children of process 0. 29 .RE 30 31 .sp 32 .ne 2 33 .na 34 \fB\fB-c\fR\fR 35 .ad 36 .RS 11n 37 Contracts. Print process contract memberships and their associated SMF FMRIs, 38 in addition to parent-child relationships. See \fBprocess\fR(4). 39 This option implies the \fB-a\fR option. 40 .RE 41 42 .sp 43 .ne 2 44 .na 45 \fB\fB-s\fR \fIsvc\fR\fR 46 .ad 47 .RS 11n 48 Print only processes with an SMF service FMRI matching the argument. The FMRI 49 may be in truncated form (such as 'console-login'). This includes child 50 processes even if they are not members of the service contract. 51 See \fBprocess\fR(4). 52 .RE 53 54 .sp 55 .ne 2 56 .na 57 \fB\fB-z\fR \fIzone\fR\fR 58 .ad 59 .RS 11n 60 Zones. Print only processes in the specified \fIzone\fR. Each zone \fBID\fR can 61 be specified as either a zone name or a numerical zone \fBID\fR. 62 .sp 63 This option is only useful when executed in the global zone. 64 .RE 65 66 .SH OPERANDS 67 The following operands are supported: 68 .sp 69 .ne 2 70 .na 71 \fB\fIpid\fR\fR 72 .ad 73 .RS 8n 74 Process-id or a list of process-ids. \fBptree\fR also accepts 75 \fB/proc/\fR\fInnn\fR as a process-id, so the shell expansion \fB/proc/*\fR can 76 be used to specify all processes in the system. 77 .RE 78 79 .sp 80 .ne 2 81 .na 82 \fB\fIuser\fR\fR 83 .ad 84 .RS 8n 85 Username or list of usernames. Processes whose effective user IDs match those 86 given are displayed. 87 .RE 88 89 .SH EXAMPLES 90 \fBExample 1 \fRUsing ptree 91 .sp 92 .LP 93 The following example prints the process tree (including children of process 0) 94 for processes which match the command name \fBssh\fR: 95 96 .sp 97 .in +2 98 .nf 99 $ ptree -a `pgrep ssh` 100 1 /sbin/init 101 100909 /usr/lib/ssh/sshd 102 569150 /usr/lib/ssh/sshd 103 569157 /usr/lib/ssh/sshd 104 569159 -ksh 105 569171 bash 106 569173 /bin/ksh 107 569193 bash 108 .fi 109 .in -2 110 .sp 111 112 .SH EXIT STATUS 113 The following exit values are returned: 114 .sp 115 .ne 2 116 .na 117 \fB\fB0\fR\fR 118 .ad 119 .RS 12n 120 Successful operation. 121 .RE 122 123 .sp 124 .ne 2 125 .na 126 \fBnon-zero\fR 127 .ad 128 .RS 12n 129 An error has occurred. 130 .RE 131 132 .SH FILES 133 .ne 2 134 .na 135 \fB\fB/proc/*\fR\fR 136 .ad 137 .RS 11n 138 process files 139 .RE 140 141 .SH ATTRIBUTES 142 See \fBattributes\fR(5) for descriptions of the following attributes: 143 .sp 144 145 .sp 146 .TS 147 box; 148 c | c 149 l | l . 150 ATTRIBUTE TYPE ATTRIBUTE VALUE 151 _ 152 Interface Stability See below. 153 .TE 154 155 .sp 156 .LP 157 The human readable output is Unstable. The options are Evolving. 158 .SH SEE ALSO 159 \fBgcore\fR(1), \fBldd\fR(1), \fBpargs\fR(1), \fBpgrep\fR(1), \fBpkill\fR(1), 160 \fBplimit\fR(1), \fBpmap\fR(1), \fBpreap\fR(1), \fBproc\fR(1), \fBps\fR(1), 161 \fBppgsz\fR(1), \fBpwd\fR(1), \fBrlogin\fR(1), \fBtime\fR(1), \fBtruss\fR(1), 162 \fBwait\fR(1), \fBfcntl\fR(2), \fBfstat\fR(2), \fBsetuid\fR(2), 163 \fBdlopen\fR(3C), \fBsignal.h\fR(3HEAD), \fBcore\fR(4), \fBproc\fR(4), 164 \fBprocess\fR(4), \fBattributes\fR(5), \fBzones\fR(5)