PTREE(1) User Commands PTREE(1)

NAME


ptree - print process trees

SYNOPSIS


ptree [-a] [-c] [-g] [-w] [-s svc] [-z zone] [pid | user]...

DESCRIPTION


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.

OPTIONS


The following options are supported:

-a All. Print all processes, including children of process 0.

-c Contracts. Print process contract memberships and their
associated SMF FMRIs, in addition to parent-child
relationships. See process(5). This option implies the -a
option.

-g Use line drawing characters. If the current locale is a UTF-8
locale, the UTF-8 line drawing characters are used, otherwise
ASCII line drawing characters are used.

-s svc Print only processes with an SMF service FMRI matching the
argument. The FMRI may be in truncated form (such as
`console-login'). This includes child processes even if they
are not members of the service contract. See process(5).

-w Allow output lines to wrap. Normally output lines are
truncated to the current width of the terminal window.

-z zone Zones. Print only processes in the specified zone. Each zone
ID can be specified as either a zone name or a numerical zone
ID.

This option is only useful when executed in the global zone.

OPERANDS


The following operands are supported:

pid Process-id or a list of process-ids. ptree also accepts
/proc/nnn as a process-id, so the shell expansion /proc/* can be
used to specify all processes in the system.

user Username or list of usernames. Processes whose effective user
IDs match those given are displayed.

FILES


/proc/* process files

EXIT STATUS


The ptree utility exits 0 on success, and >0 if an error occurs.

EXAMPLES


Example 1 Using ptree

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

Example 2

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

INTERFACE STABILITY


Not-an-Interface

SEE ALSO


pargs(1), pgrep(1), pkill(1), preap(1), proc(1), ps(1), contract(5),
proc(5), process(5), attributes(7), zones(7)

illumos January 9, 2025 illumos

tribblix@gmail.com :: GitHub :: Privacy