Print this page
10270 Convert ptree(1) to mandoc
   1 '\" te
   2 .\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved.
   3 .\" 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.
   4 .\" 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.
   5 .\" 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]
   6 .TH PTREE 1 "Oct 11, 2005"
   7 .SH NAME
   8 ptree \- print process trees
   9 .SH SYNOPSIS
  10 .LP
  11 .nf
  12 \fB/usr/bin/ptree\fR [\fB-a\fR] [\fB-c\fR] [\fB-z\fR \fIzone\fR] [\fIpid\fR | \fIuser\fR]...
  13 .fi
  14 
  15 .SH DESCRIPTION
  16 .sp
  17 .LP
  18 The \fBptree\fR utility prints the process trees containing the specified
  19 \fIpid\fRs or \fIuser\fRs, with child processes indented from their respective
  20 parent processes. An argument of all digits is taken to be a process-ID,
  21 otherwise it is assumed to be a user login name. The default is all processes.
  22 .SH OPTIONS
  23 .sp
  24 .LP



















  25 The following options are supported:
  26 .sp
  27 .ne 2
  28 .na
  29 \fB\fB-a\fR\fR
  30 .ad
  31 .RS 11n
  32 All. Print all processes, including children of process 0.
  33 .RE
  34 
  35 .sp
  36 .ne 2
  37 .na
  38 \fB\fB-c\fR\fR
  39 .ad
  40 .RS 11n
  41 Contracts. Print process contract memberships in addition to parent-child
  42 relationships. See \fBprocess\fR(4). This option implies the \fB-a\fR option.
  43 .RE
  44 
  45 .sp
  46 .ne 2
  47 .na
  48 \fB\fB-z\fR \fIzone\fR\fR
  49 .ad
  50 .RS 11n
  51 Zones. Print only processes in the specified \fIzone\fR. Each zone \fBID\fR can
  52 be specified as either a zone name or a numerical zone \fBID\fR.
  53 .sp
  54 This option is only useful when executed in the global zone.
  55 .RE
  56 
  57 .SH OPERANDS
  58 .sp
  59 .LP
  60 The following operands are supported:
  61 .sp
  62 .ne 2
  63 .na
  64 \fB\fIpid\fR\fR
  65 .ad
  66 .RS 8n
  67 Process-id or a list of process-ids. \fBptree\fR also accepts
  68 \fB/proc/\fR\fInnn\fR as a process-id, so the shell expansion \fB/proc/*\fR can
  69 be used to specify all processes in the system.
  70 .RE
  71 
  72 .sp
  73 .ne 2
  74 .na
  75 \fB\fIuser\fR\fR
  76 .ad
  77 .RS 8n
  78 Username or list of usernames. Processes whose effective user IDs match those
  79 given are displayed.
  80 .RE
  81 
  82 .SH EXAMPLES
  83 .LP
  84 \fBExample 1 \fRUsing ptree
  85 .sp
  86 .LP






  87 The following example prints the process tree (including children of process 0)
  88 for processes which match the command name \fBssh\fR:
  89 
  90 .sp
  91 .in +2
  92 .nf
  93 $ ptree -a `pgrep ssh`
  94         1     /sbin/init
  95           100909 /usr/lib/ssh/sshd
  96             569150 /usr/lib/ssh/sshd
  97               569157 /usr/lib/ssh/sshd
  98                 569159 -ksh
  99                   569171 bash
 100                     569173 /bin/ksh
 101                       569193 bash
 102 .fi
 103 .in -2
 104 .sp
 105 
 106 .SH EXIT STATUS
 107 .sp
 108 .LP
 109 The following exit values are returned:
 110 .sp
 111 .ne 2
 112 .na
 113 \fB\fB0\fR\fR
 114 .ad
 115 .RS 12n
 116 Successful operation.
 117 .RE
 118 
 119 .sp
 120 .ne 2
 121 .na
 122 \fBnon-zero\fR
 123 .ad
 124 .RS 12n
 125 An error has occurred.
 126 .RE
 127 
 128 .SH FILES
 129 .sp
 130 .ne 2
 131 .na
 132 \fB\fB/proc/*\fR\fR
 133 .ad
 134 .RS 11n
 135 process files
 136 .RE
 137 
 138 .SH ATTRIBUTES
 139 .sp
 140 .LP
 141 See \fBattributes\fR(5) for descriptions of the following attributes:
 142 .sp
 143 
 144 .sp
 145 .TS
 146 box;
 147 c | c
 148 l | l .
 149 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 150 _
 151 Interface Stability     See below.
 152 .TE
 153 
 154 .sp
 155 .LP
 156 The human readable output is Unstable. The options are Evolving.
 157 .SH SEE ALSO
 158 .sp
 159 .LP
 160 \fBgcore\fR(1), \fBldd\fR(1), \fBpargs\fR(1), \fBpgrep\fR(1), \fBpkill\fR(1),
 161 \fBplimit\fR(1), \fBpmap\fR(1), \fBpreap\fR(1), \fBproc\fR(1), \fBps\fR(1),
 162 \fBppgsz\fR(1), \fBpwd\fR(1), \fBrlogin\fR(1), \fBtime\fR(1), \fBtruss\fR(1),
 163 \fBwait\fR(1), \fBfcntl\fR(2), \fBfstat\fR(2), \fBsetuid\fR(2),
 164 \fBdlopen\fR(3C), \fBsignal.h\fR(3HEAD), \fBcore\fR(4), \fBproc\fR(4),
 165 \fBprocess\fR(4), \fBattributes\fR(5), \fBzones\fR(5)

   1 .\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved.
   2 .\" Copyright 2019, Joyent, Inc.
   3 .\"
   4 .\" The contents of this file are subject to the terms of the
   5 .\" Common Development and Distribution License (the "License").
   6 .\" You may not use this file except in compliance with the License.
   7 .\"
   8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9 .\" or http://www.opensolaris.org/os/licensing.
  10 .\" See the License for the specific language governing permissions
  11 .\" and limitations under the License.
  12 .\"
  13 .\" When distributing Covered Code, include this CDDL HEADER in each
  14 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15 .\" If applicable, add the following below this CDDL HEADER, with the
  16 .\" fields enclosed by brackets "[]" replaced with your own identifying
  17 .\" information: Portions Copyright [yyyy] [name of copyright owner]
  18 .\"
  19 .Dd January 12, 2019
  20 .Dt PTREE 1
  21 .Os
  22 .Sh NAME
  23 .Nm ptree
  24 .Nd print process trees
  25 .Sh SYNOPSIS
  26 .Nm
  27 .Op Fl a
  28 .Op Fl c
  29 .Op Fl z Ar zone
  30 .Oo Ar pid | Ar user Oc Ns ...
  31 .Sh DESCRIPTION
  32 The
  33 .Nm
  34 utility prints the process trees containing the specified
  35 .Ar pid Ns s
  36 or
  37 .Ar user Ns s ,
  38 with child processes indented from their respective parent processes.
  39 An argument of all digits is taken to be a process-ID,
  40 otherwise it is assumed to be a user login name.
  41 The default is all processes.
  42 .Sh OPTIONS
  43 The following options are supported:
  44 .Bl -tag -width "-z zone"
  45 .It Fl a
  46 All.
  47 Print all processes, including children of process 0.
  48 .It Fl c
  49 Contracts.
  50 Print process contract memberships in addition to parent-child relationships.
  51 See
  52 .Xr process 4 .
  53 This option implies the
  54 .Fl a
  55 option.
  56 .It Fl z Ar zone
  57 Zones.
  58 Print only processes in the specified
  59 .Ar zone .
  60 Each zone
  61 .Sy ID
  62 can be specified as either a zone name or a numerical zone
  63 .Sy ID .
  64 .Pp







  65 This option is only useful when executed in the global zone.
  66 .El
  67 .Sh OPERANDS



  68 The following operands are supported:
  69 .Bl -tag -width "user"
  70 .It Ar pid
  71 Process-id or a list of process-ids.
  72 .Nm
  73 also accepts
  74 .Pa /proc/ Ns Em nnn
  75 as a process-id, so the shell expansion
  76 .Pa /proc/*
  77 can be used to specify all processes in the system.
  78 .It Ar user
  79 Username or list of usernames.
  80 Processes whose effective user IDs match those






  81 given are displayed.
  82 .El
  83 .Sh FILES
  84 .Bl -tag -width Pa
  85 .It Pa /proc/*
  86 process files
  87 .El
  88 .Sh EXIT STATUS
  89 .Ex -std
  90 .Sh EXAMPLES
  91 .Bl -inset
  92 .It Sy Example 1
  93 Using ptree
  94 .Pp
  95 The following example prints the process tree (including children of process 0)
  96 for processes which match the command name
  97 .Sy ssh :
  98 .Bd -literal -offset 2n


  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 .Ed
 109 .El
 110 .Sh INTERFACE STABILITY
 111 Not-an-Interface
 112 .Sh SEE ALSO
 113 .Xr gcore 1 ,
 114 .Xr ldd 1 ,
 115 .Xr pargs 1 ,
 116 .Xr pgrep 1 ,
 117 .Xr pkill 1 ,
 118 .Xr plimit 1 ,
 119 .Xr pmap 1 ,
 120 .Xr ppgsz 1 ,
 121 .Xr preap 1 ,
 122 .Xr proc 1 ,
 123 .Xr ps 1 ,
 124 .Xr pwd 1 ,
 125 .Xr rlogin 1 ,
 126 .Xr time 1 ,
 127 .Xr truss 1 ,
 128 .Xr wait 1 ,
 129 .Xr fcntl 2 ,
 130 .Xr fstat 2 ,
 131 .Xr setuid 2 ,
 132 .Xr dlopen 3C ,
 133 .Xr signal.h 3HEAD ,
 134 .Xr core 4 ,
 135 .Xr proc 4 ,
 136 .Xr process 4 ,
 137 .Xr attributes 5 ,
 138 .Xr zones 5