Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Linux pstree command

Linux pstree command

Linux Command Reference Linux Command Reference

The Linux pstree (display a tree of processes) command displays all processes as a tree diagram. The tree is rooted at the pid (if specified) or at the basic init process. If a user id is specified, the tree will show only the processes owned by that user.

Permissions required: all users.

Syntax

pstree [-a] [-c] [-h|-Hpid] [-l] [-n] [-p] [-u] [-G|-U] [pid|user]

or

pstree -V

Parameter Description:

Example

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

....

Specially mark running processes

# pstree -apnh //显示进程间的关系

Also display the user name

# pstree -u //显示用户名称

Linux Command Reference Linux Command Reference