La commande 'proctree' est très utile pour lister une liste de processus attachés.

Par défaut, la commande vous liste le processus donné en argument ainsi que tous les sous-processus fils générés et les processus parents.

La syntaxe est décrite ci-dessous :

'proctree  num_processus'.

L'option -a permet de détailler également les enfants du processus 0.

Ci-dessous la documentation AIX V6 officielle en anglais.

 

VVVVVVVVV

proctree Command

Purpose

Prints the process tree containing the specified process IDs or users.

Syntax

proctree [ -a ] [ { ProcessID | User } ]

proctree [ -a ] [ -T ] [ -t ] [ { -p ProcessID | -u User } ] [ -@ [ WparName] ]

Description

The /proc filesystem provides a mechanism to control processes. It also gives access to information about the current state of processes and threads, but in binary form. The proctools commands provide ascii reports based on some of the available information.

Most of the commands take a list of process IDs or /proc/ ProcessID strings as input. The shell expansion /proc/* can therefore be used to specify all processes in the system.

Each of the proctools commands gathers information from /proc for the specified processes and displays it to the user. The proctools commands like procrun and procstop start and stop a process using the /proc interface.

The information gathered by the commands from /proc is a snapshot of the current state of processes, and therefore can vary at any instant except for stopped processes.

The proctree command prints the process tree containing the specified process IDs or users. The child processes are indented from their respective parent processes. An argument of all digits is taken to be a process ID, otherwise it is assumed to be a user login name. The default action is to report on all processes, except children of process 0.

When you specify the -@ flag with no parameters, all WPAR names are displayed. If you specify the WparName parameter, only those WPAR names are displayed.

For displaying thread IDs and associated pthread IDs, specify the -t option. For a kernel process, the proctree command only displays the thread ID.

Flags

-a Includes children of process 0 in the display. The default is to exclude them.
ProcessID Specifies the process ID.
-p ProcessID Specifies the process ID.
-T Displays the formatted output of the process tree.
-t Displays thread IDs and associated pthread IDs for the process.
User Specifies the user name.
-u User Specifies the user name.
-@ Displays all WPAR names.
Note:
The -@ flag is not supported when executed within a workload partition.
-@ WparName Displays only the processes of the WPAR you specify using the WparName parameter.
Note:
The -@ flag is not supported when executed within a workload partition.

Examples

  1. To display the ancestors and all the children of the 12312 process, enter the following command:
    proctree 12312
    The output of this command might look like this:
    4954    /usr/sbin/srcmstr                     
    7224 /usr/sbin/inetd
    5958 telnetd -a
    13212 -sh
    14718 ./proctree 13212
  2. To display the ancestors and children of the 12312 process, including children of process 0, enter the following command:
    proctree -a 12312
    The output of this command might look like this:
    1    /etc/init                                  
    4954 /usr/sbin/srcmstr
    7224 /usr/sbin/inetd
    5958 telnetd -a
    13212 -sh
    14724 ./proctree -a 13212
  3. To display the process tree of WPAR corral2, enter the following command:
    proctree -@ corral2
    The output of this command might look like this:
    corral2       401496   /etc/init
    corral2 319680 /usr/sbin/srcmstr
    corral2 102636 /usr/sbin/inetd
    corral2 249954 /usr/sbin/rsct/bin/rmcd -a IBM.LPCommands -r
    corral2 254132 /usr/sbin/rsct/bin/IBM.AuditRMd
    corral2 295098 /usr/sbin/rsct/bin/IBM.ServiceRMd
    corral2 303218 /usr/dt/bin/dtlogin
    corral2 307370 /usr/sbin/writesrv
    corral2 323836 /usr/sbin/qdaemon
    corral2 331970 /usr/sbin/muxatmd
    corral2 348210 /usr/sbin/syslogd
    corral2 352472 sendmail: accepting connections H nnections
    corral2 364564 /usr/sbin/rsct/bin/IBM.ERrmd
    corral2 405522 /usr/sbin/portmap
    corral2 282800 /usr/bin/xmwlm -L
    corral2 311454 /usr/sbin/cron
    corral2 376920 /usr/lib/errdemon
  4. To display the WPAR name of the processes, enter the following command:
    proctree -@
    The output of this command might look like this:
    Global     114788   /usr/dt/bin/dtlogin -daemon
    Global 86108 dtlogin -daemon
    Global 123022 dtgreet 8 :0
    Global 77944 /usr/lib/errdemon
    Global 94314 /usr/sbin/syncd 60
    Global 168084 /usr/sbin/srcmstr
    Global 110688 /usr/sbin/rsct/bin/IBM.ServiceRMd
    corral2 401496 /etc/init
    corral2 319680 /usr/sbin/srcmstr
    corral2 102636 /usr/sbin/inetd
    corral2 249954 /usr/sbin/rsct/bin/rmcd -a IBM.LPCommands -r
    corral2 254132 /usr/sbin/rsct/bin/IBM.AuditRMd
    corral2 331970 /usr/sbin/muxatmd
    corral2 348210 /usr/sbin/syslogd
    corral2 364564 /usr/sbin/rsct/bin/IBM.ERrmd
    corral2 405522 /usr/sbin/portmap
    corral2 282800 /usr/bin/xmwlm -L
    corral2 311454 /usr/sbin/cron
    corral2 376920 /usr/lib/errdemon
    Global 151626 /usr/ccs/bin/shlap64
    Global 274578 /usr/sbin/getty /dev/console
    ...
  5. To display the ancestors, all of the children, and the WPAR name of the 102636 process, enter the following command:
    proctree  -p 102636 -@
    The output of this command might look like this:
    Global     168084    /usr/sbin/srcmstr
    corral2 401496 /etc/init
    corral2 319680 /usr/sbin/srcmstr
    corral2 102636 /usr/sbin/inetd
  6. To display the formatted process-tree output of the 213246 process, enter the following command:
    proctree -T -p 213246
    The output of this command might look like this:
    192652        \--/usr/sbin/srcmstr
    200830 \--/usr/sbin/inetd
    213246 \--telnetd -a
    229592 \---ksh
  7. To display thread IDs and associated pthread IDs for the 344172 process, enter the following command:
    proctree -t -p 344172
    The output of this command might look like this:
    192652    /usr/sbin/srcmstr
    TID : 225535 (pTID : 1)
    200830 /usr/sbin/inetd
    TID : 360677 (pTID : 1)
    323642 telnetd -a
    TID : 770057 (pTID : 1)
    307428 -ksh
    TID : 1056861 (pTID : 1)
    344172 appthd
    TID : 1065119 (pTID : 1)
    TID : 1028171 (pTID : 258)
    TID : 1011789 (pTID : 2057)
    TID : 1024105 (pTID : 1800)
  8. To display the formatted process-tree output for the 344172 process along with thread IDs and associated pthread IDs, enter the following command:
    proctree -tT -p 344172
    The output of this command might look like this:
    192652   \--/usr/sbin/srcmstr
    ~~TID : 225535 (pTID : 1)
    200830 \--/usr/sbin/inetd
    ~~TID : 360677 (pTID : 1)
    323642 \--telnetd -a
    ~~TID : 770057 (pTID : 1)
    307428 \---ksh
    ~~TID : 1056861 (pTID : 1)
    344172 \--appthd
    |~~TID : 1065119 (pTID : 1)
    |~~TID : 1028171 (pTID : 258)
    |~~TID : 1011789 (pTID : 2057)
    ~~TID : 1024105 (pTID : 1800)
  9. To display the formatted process-tree output for the pconsole user , enter the following command:
    proctree -T -u pconsole
    The output of this command might look like this:
    192652  \--/usr/sbin/srcmstr
    225400 \--/bin/ksh /pconsole/lwi/bin/lwistart_src.sh
    241824 \--/bin/ksh /pconsole/lwi/bin/lwistart_src.sh
    340154 \--/usr/java5/bin/java -Xmx512m -Xms20m -Xscmx10m -Xshareclasses -Dfile.encoding=U

icon phone
Téléphone/Whatsapp : +33 (0)6 83 84 85 74
icon phone