| PTREE(1) | User Commands | PTREE(1) | 
ptree — print
    process trees
| ptree | [ -a] [-c]
      [-g] [-w]
      [-ssvc]
      [-zzone]
      [pid | user]... | 
The ptree utility prints the process trees
    containing the specified pids or
    users, with child processes 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 is
    all processes.
The following options are supported:
-a-c-a option.-g-s
    svcconsole-login’). This includes
      child processes even if they are not members of the service contract. See
      process(5).-w-z
    zoneThis option is only useful when executed in the global zone.
The following operands are supported:
ptree also
      accepts
      /proc/nnn
      as a process-id, so the shell expansion /proc/*
      can be used to specify all processes in the system.The ptree utility exits 0 on
    success, and >0 if an error occurs.
The following example prints the process tree (including children of process 0) for processes which match the command name ssh:
$ ptree -a `pgrep ssh`
        1     /sbin/init
          100909 /usr/lib/ssh/sshd
            569150 /usr/lib/ssh/sshd
              569157 /usr/lib/ssh/sshd
                569159 -ksh
                  569171 bash
                    569173 /bin/ksh
                      569193 bash
    The following example prints the process tree (including
        children of process 0) for processes which match the command name
        ‘ssh’ with ASCII line drawing
        characters:
$ ptree -ag `pgrep ssh`
        1     /sbin/init
        `-100909 /usr/lib/ssh/sshd
          `-569150 /usr/lib/ssh/sshd
            `-569157 /usr/lib/ssh/sshd
              `-569159 -ksh
                `-569171 bash
                  `-569173 /bin/ksh
                    `-569193 bash
    Not-an-Interface
pargs(1), pgrep(1), pkill(1), preap(1), proc(1), ps(1), contract(5), proc(5), process(5), attributes(7), zones(7)
| January 9, 2025 | OmniOS |