← 返回命令列表

Linux command

pstree 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

pstree

Example

pstree -p

Example

pstree username

Example

pstree -a

Example

pstree 1234

Example

pstree -s 1234

Highlight

pstree -h

说明

pstree shows running processes as a tree. The tree is rooted at either pid or init if pid is omitted. It visually compacts identical branches using square brackets and counts, and displays child threads under parent processes in curly braces.

参数

-a, --arguments
Display command line arguments
-c, --compact-not
Disable compaction of identical subtrees
-C, --color
Color process names by attribute (e.g., age)
-g, --show-pgids
Show process group IDs
-h, --highlight-all
Highlight current process and its ancestors
-H pid, --highlight-pid
Highlight specified process and its ancestors
-l, --long
Display full-length lines without truncation
-n, --numeric-sort
Sort processes by PID instead of name
-N, --ns-sort
Show individual trees per namespace type
-p, --show-pids
Display process IDs
-s, --show-parents
Show parent processes of the specified process
-t, --thread-names
Show full thread names
-T, --hide-threads
Hide threads; show only processes
-u, --uid-changes
Show uid transitions
-Z, --security-context
Display SELinux security context
-A
Use ASCII line-drawing characters
-G
Use VT100 line-drawing characters
-U
Use UTF-8 line-drawing characters

FAQ

What is the pstree command used for?

pstree shows running processes as a tree. The tree is rooted at either pid or init if pid is omitted. It visually compacts identical branches using square brackets and counts, and displays child threads under parent processes in curly braces.

How do I run a basic pstree example?

Run `pstree` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -a, --arguments do in pstree?

Display command line arguments