Pstree

来自WordPress中文文档
跳转至: 导航搜索

Linux命令:pstree

功能说明:以树状图显示程序。
语  法:pstree [-acGhlnpuUV][-H <程序识别码>][<程序识别码>/<用户名称>]

补充说明:pstree指令用ASCII字符显示树状结构,清楚地表达程序间的相互关系。如果不指定程序识别码或用户名称,则会把系统启动时的第一个程序视为基层,并显示之后的所有程序。若指定用户名称,便会以隶属该用户的第一个程序当作基层,然后显示该用户的所有程序。

参  数:
-a  显示每个程序的完整指令,包含路径,参数或是常驻服务的标示。 
-c  不使用精简标示法。 
-G  使用VT100终端机的列绘图字符。 
-h  列出树状图时,特别标明现在执行的程序。 
-H<程序识别码>  此参数的效果和指定"-h"参数类似,但特别标明指定的程序。 
-l  采用长列格式显示树状图。 
-n  用程序识别码排序。预设是以程序名称来排序。 
-p  显示程序识别码。 
-u  显示用户名称。 
-U  使用UTF-8列绘图字符。 
-V  显示版本信息。 


英文版本,欢迎翻译:

NAME pstree - display a tree of processes

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

DESCRIPTION pstree shows running processes as a tree. The tree is rooted at either pid or init if pid is omitted. If a user name is specified, all process trees rooted at processes owned by that user are shown.

pstree visually merges identical branches by putting them in square brackets and prefixing them with the repetition count, e.g.

init-+-getty |-getty |-getty `-getty

becomes

init---4*[getty]

OPTIONS -a Show command line arguments. If the command line of a process is swapped out, that process is shown in parentheses. -a implicitly disables compaction.

-c Disable compaction of identical subtrees. By default, subtrees are compacted whenever possible.

-G Use VT100 line drawing characters.

-h Highlight the current process and its ancestors. This is a no-op if the terminal doesnt support highlighting or if neither the current process nor any of its ancestors are in the subtree being shown.

-H Like -h, but highlight the specified process instead. Unlike with -h, pstree fails when using -H if highlighting is not available.

-l Display long lines. By default, lines are truncated to the display width or 132 if output is sent to a non-tty or if the display width is unknown.

-n Sort processes with the same ancestor by PID instead of by name. (Numeric sort.)

-p Show PIDs. PIDs are shown as decimal numbers in parentheses after each process name. -p implic? itly disables compaction.

-u Show uid transitions. Whenever the uid of a process differs from the uid of its parent, the new uid is shown in parentheses after the process name.

-U Use UTF-8 (Unicode) line drawing characters. Under Linux 1.1-54 and above, UTF-8 mode is entered on the console with echo -e 33%8 and left with echo -e 33%@

-V Display version information.

FILES /proc location of the proc file system

AUTHOR Werner Almesberger <Werner.Almesberger@epfl.ch>

SEE ALSO ps(1), top(1)

Linux May 6, 1998