• 要找福利?记不住网址?搜不到?如何与我们保持联系?试试 CTRL+D 把零点博客添加进您的浏览器收藏夹,一键直达永不失联!

系统管理-Linux pstree命令

linux系统 涛涛 132次浏览 0个评论

Linux pstree命令

Linux 命令大全 Linux 命令大全

Linux pstree命令将所有行程以树状图显示,树状图将会以 pid (如果有指定) 或是以 init 这个基本行程为根 (root),如果有指定使用者 id,则树状图会只显示该使用者所拥有的行程。

使用权限:所有使用者。

语法

<span class="pln">pstree </span><span class="pun">[-</span><span class="pln">a</span><span class="pun">]</span> <span class="pun">[-</span><span class="pln">c</span><span class="pun">]</span> <span class="pun">[-</span><span class="pln">h</span><span class="pun">|-</span><span class="typ">Hpid</span><span class="pun">]</span> <span class="pun">[-</span><span class="pln">l</span><span class="pun">]</span> <span class="pun">[-</span><span class="pln">n</span><span class="pun">]</span> <span class="pun">[-</span><span class="pln">p</span><span class="pun">]</span> <span class="pun">[-</span><span class="pln">u</span><span class="pun">]</span> <span class="pun">[-</span><span class="pln">G</span><span class="pun">|-</span><span class="pln">U</span><span class="pun">]</span> <span class="pun">[</span><span class="pln">pid</span><span class="pun">|</span><span class="pln">user</span><span class="pun">]</span>

<span class="pln">pstree </span><span class="pun">-</span><span class="pln">V</span>

参数说明

  • -a 显示该行程的完整指令及参数, 如果是被记忆体置换出去的行程则会加上括号
  • -c 如果有重覆的行程名, 则分开列出(预设值是会在前面加上 *)

实例

显示进程的关系

<span class="pln">pstree
init</span><span class="pun">-+-</span><span class="pln">amd
</span><span class="pun">|-</span><span class="pln">apmd
</span><span class="pun">|-</span><span class="pln">atd
</span><span class="pun">|-</span><span class="pln">httpd</span><span class="pun">---</span><span class="lit">10</span><span class="pun">*[</span><span class="pln">httpd</span><span class="pun">]</span>
<span class="pun">%</span><span class="pln">pstree </span><span class="pun">-</span><span class="pln">p
init</span><span class="pun">(</span><span class="lit">1</span><span class="pun">)-+-</span><span class="pln">amd</span><span class="pun">(</span><span class="lit">447</span><span class="pun">)</span>
<span class="pun">|-</span><span class="pln">apmd</span><span class="pun">(</span><span class="lit">105</span><span class="pun">)</span>
<span class="pun">|-</span><span class="pln">atd</span><span class="pun">(</span><span class="lit">339</span><span class="pun">)</span>
<span class="pun">%</span><span class="pln">pstree </span><span class="pun">-</span><span class="pln">c
init</span><span class="pun">-+-</span><span class="pln">amd
</span><span class="pun">|-</span><span class="pln">apmd
</span><span class="pun">|-</span><span class="pln">atd
</span><span class="pun">|-</span><span class="pln">httpd</span><span class="pun">-+-</span><span class="pln">httpd
</span><span class="pun">|</span> <span class="pun">|-</span><span class="pln">httpd
</span><span class="pun">|</span> <span class="pun">|-</span><span class="pln">httpd
</span><span class="pun">|</span> <span class="pun">|-</span><span class="pln">httpd
</span><span class="pun">....</span>

特别表明在运行的进程

<span class="com"># pstree -apnh //显示进程间的关系</span>

同时显示用户名称

<span class="com"># pstree -u //显示用户名称</span>

欢迎转载本文:系统管理-Linux pstree命令
喜欢 (0)
[ld]
分享 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址