Linux pstree Command
Complete List of Linux Commands
The Linux pstree command (full English name: display a tree of processes) displays all processes in a tree diagram. The tree diagram will use pid (if specified) or the basic process init as the root (root). If a user id is specified, the tree diagram will only display processes owned by that user.
Permissions: All users.
Syntax
pstree [-a] [-c] [-h|-Hpid] [-l] [-n] [-p] [-u] [-G|-U] [pid|user]
or
pstree -V
Parameter description:
- -a Display the complete command and parameters of the process. If the process has been swapped out of memory, it will be enclosed in parentheses.
- -c If there are duplicate process names, list them separately (the default is to prepend *).
Examples
Display process relationships
pstree init-+-amd |-apmd |-atd |-httpd---10*[httpd] %pstree -p init(1)-+-amd(447) |-apmd(105) |-atd(339) %pstree -c init-+-amd |-apmd |-atd |-httpd-+-httpd | |-httpd | |-httpd | |-httpd ....
Specifically indicate running processes
# pstree -apnh //显示进程间的关系
Also display user names
# pstree -u //显示用户名称Other extensions