jackadmi 2019-11-06
很多次,你可能遇见过系统消耗了过多的内存。如果是这种情况,那么好的办法是识别出 Linux 机器上消耗过多内存的进程。我相信,你可能已经运行了下文中的命令以进行检查。如果没有,那你尝试过哪些其他的命令?我希望你可以在评论中更新这篇文章,它可能会帮助其他用户。
使用 top 命令 和 ps 命令 可以轻松的识别这种情况。我过去经常同时使用这两个命令,两个命令得到的结果是相同的。所以我建议你从中选择一个喜欢的使用就可以。
ps
命令用于报告当前进程的快照。ps
命令的意思是“进程状态”。这是一个标准的 Linux 应用程序,用于查找有关在 Linux 系统上运行进程的信息。
它用于列出当前正在运行的进程及其进程 ID(PID)、进程所有者名称、进程优先级(PR)以及正在运行的命令的绝对路径等。
下面的 ps
命令格式为你提供有关内存消耗最大进程的更多信息。
<span class="com">#</span><span class="pln"> </span><span class="kwd">ps</span><span class="pln"> aux </span><span class="pun">--</span><span class="kwd">sort</span><span class="pln"> </span><span class="pun">-</span><span class="pln">rss </span><span class="pun">|</span><span class="pln"> </span><span class="kwd">head</span>
<span class="pln">USER PID </span><span class="pun">%</span><span class="pln">CPU </span><span class="pun">%</span><span class="pln">MEM VSZ RSS TTY STAT START TIME COMMAND</span>
<span class="pln">mysql </span><span class="lit">1064</span><span class="pln"> </span><span class="lit">3.2</span><span class="pln"> </span><span class="lit">5.4</span><span class="pln"> </span><span class="lit">886076</span><span class="pln"> </span><span class="lit">209988</span><span class="pln"> </span><span class="pun">?</span><span class="pln"> </span><span class="typ">Ssl</span><span class="pln"> </span><span class="typ">Oct25</span><span class="pln"> </span><span class="lit">62</span><span class="pun">:</span><span class="lit">40</span><span class="pln"> </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">sbin</span><span class="pun">/</span><span class="pln">mysqld</span>
<span class="pln">varnish </span><span class="lit">23396</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">2.9</span><span class="pln"> </span><span class="lit">286492</span><span class="pln"> </span><span class="lit">115616</span><span class="pln"> </span><span class="pun">?</span><span class="pln"> </span><span class="typ">SLl</span><span class="pln"> </span><span class="typ">Oct25</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">42</span><span class="pln"> </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">sbin</span><span class="pun">/</span><span class="pln">varnishd </span><span class="pun">-</span><span class="pln">P </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">run</span><span class="pun">/</span><span class="pln">varnish</span><span class="pun">.</span><span class="pln">pid </span><span class="pun">-</span><span class="pln">f </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">varnish</span><span class="pun">/</span><span class="kwd">default</span><span class="pun">.</span><span class="pln">vcl </span><span class="pun">-</span><span class="pln">a </span><span class="pun">:</span><span class="lit">82</span><span class="pln"> </span><span class="pun">-</span><span class="pln">T </span><span class="lit">127.0</span><span class="pun">.</span><span class="lit">0.1</span><span class="pun">:</span><span class="lit">6082</span><span class="pln"> </span><span class="pun">-</span><span class="pln">S </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">varnish</span><span class="pun">/</span><span class="pln">secret </span><span class="pun">-</span><span class="pln">s malloc</span><span class="pun">,</span><span class="lit">256M</span>
<span class="pln">named </span><span class="lit">1105</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">2.7</span><span class="pln"> </span><span class="lit">311712</span><span class="pln"> </span><span class="lit">108204</span><span class="pln"> </span><span class="pun">?</span><span class="pln"> </span><span class="typ">Ssl</span><span class="pln"> </span><span class="typ">Oct25</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">16</span><span class="pln"> </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">sbin</span><span class="pun">/</span><span class="pln">named </span><span class="pun">-</span><span class="pln">u named </span><span class="pun">-</span><span class="pln">c </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">named</span><span class="pun">.</span><span class="pln">conf</span>
<span class="pln">nobody </span><span class="lit">23377</span><span class="pln"> </span><span class="lit">0.2</span><span class="pln"> </span><span class="lit">2.3</span><span class="pln"> </span><span class="lit">153096</span><span class="pln"> </span><span class="lit">89432</span><span class="pln"> </span><span class="pun">?</span><span class="pln"> S </span><span class="typ">Oct25</span><span class="pln"> </span><span class="lit">4</span><span class="pun">:</span><span class="lit">35</span><span class="pln"> nginx</span><span class="pun">:</span><span class="pln"> worker process</span>
<span class="pln">nobody </span><span class="lit">23376</span><span class="pln"> </span><span class="lit">0.1</span><span class="pln"> </span><span class="lit">2.1</span><span class="pln"> </span><span class="lit">147096</span><span class="pln"> </span><span class="lit">83316</span><span class="pln"> </span><span class="pun">?</span><span class="pln"> S </span><span class="typ">Oct25</span><span class="pln"> </span><span class="lit">2</span><span class="pun">:</span><span class="lit">18</span><span class="pln"> nginx</span><span class="pun">:</span><span class="pln"> worker process</span>
<span class="pln">root </span><span class="lit">23375</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">1.7</span><span class="pln"> </span><span class="lit">131028</span><span class="pln"> </span><span class="lit">66764</span><span class="pln"> </span><span class="pun">?</span><span class="pln"> </span><span class="typ">Ss</span><span class="pln"> </span><span class="typ">Oct25</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">01</span><span class="pln"> nginx</span><span class="pun">:</span><span class="pln"> master process </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">sbin</span><span class="pun">/</span><span class="pln">nginx </span><span class="pun">-</span><span class="pln">c </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">.</span><span class="pln">conf</span>
<span class="pln">nobody </span><span class="lit">23378</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">1.6</span><span class="pln"> </span><span class="lit">130988</span><span class="pln"> </span><span class="lit">64592</span><span class="pln"> </span><span class="pun">?</span><span class="pln"> S </span><span class="typ">Oct25</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">00</span><span class="pln"> nginx</span><span class="pun">:</span><span class="pln"> cache manager process</span>
<span class="pln">root </span><span class="lit">1135</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">0.9</span><span class="pln"> </span><span class="lit">86708</span><span class="pln"> </span><span class="lit">37572</span><span class="pln"> </span><span class="pun">?</span><span class="pln"> S </span><span class="lit">05</span><span class="pun">:</span><span class="lit">37</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">20</span><span class="pln"> cwpsrv</span><span class="pun">:</span><span class="pln"> worker process</span>
<span class="pln">root </span><span class="lit">1133</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">0.9</span><span class="pln"> </span><span class="lit">86708</span><span class="pln"> </span><span class="lit">37544</span><span class="pln"> </span><span class="pun">?</span><span class="pln"> S </span><span class="lit">05</span><span class="pun">:</span><span class="lit">37</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">05</span><span class="pln"> cwpsrv</span><span class="pun">:</span><span class="pln"> worker process</span>
使用以下 ps
命令格式可在输出中仅展示有关内存消耗过程的特定信息。
<span class="com">#</span><span class="pln"> </span><span class="kwd">ps</span><span class="pln"> </span><span class="pun">-</span><span class="pln">eo pid</span><span class="pun">,</span><span class="pln">ppid</span><span class="pun">,%</span><span class="pln">mem</span><span class="pun">,%</span><span class="pln">cpu</span><span class="pun">,</span><span class="pln">cmd </span><span class="pun">--</span><span class="kwd">sort</span><span class="pun">=-%</span><span class="pln">mem </span><span class="pun">|</span><span class="pln"> </span><span class="kwd">head</span>
<span class="pln"> PID PPID </span><span class="pun">%</span><span class="pln">MEM </span><span class="pun">%</span><span class="pln">CPU CMD</span>
<span class="pln"> </span><span class="lit">1064</span><span class="pln"> </span><span class="lit">1</span><span class="pln"> </span><span class="lit">5.4</span><span class="pln"> </span><span class="lit">3.2</span><span class="pln"> </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">sbin</span><span class="pun">/</span><span class="pln">mysqld</span>
<span class="lit">23396</span><span class="pln"> </span><span class="lit">23386</span><span class="pln"> </span><span class="lit">2.9</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">sbin</span><span class="pun">/</span><span class="pln">varnishd </span><span class="pun">-</span><span class="pln">P </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">run</span><span class="pun">/</span><span class="pln">varnish</span><span class="pun">.</span><span class="pln">pid </span><span class="pun">-</span><span class="pln">f </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">varnish</span><span class="pun">/</span><span class="kwd">default</span><span class="pun">.</span><span class="pln">vcl </span><span class="pun">-</span><span class="pln">a </span><span class="pun">:</span><span class="lit">82</span><span class="pln"> </span><span class="pun">-</span><span class="pln">T </span><span class="lit">127.0</span><span class="pun">.</span><span class="lit">0.1</span><span class="pun">:</span><span class="lit">6082</span><span class="pln"> </span><span class="pun">-</span><span class="pln">S </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">varnish</span><span class="pun">/</span><span class="pln">secret </span><span class="pun">-</span><span class="pln">s malloc</span><span class="pun">,</span><span class="lit">256M</span>
<span class="pln"> </span><span class="lit">1105</span><span class="pln"> </span><span class="lit">1</span><span class="pln"> </span><span class="lit">2.7</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">sbin</span><span class="pun">/</span><span class="pln">named </span><span class="pun">-</span><span class="pln">u named </span><span class="pun">-</span><span class="pln">c </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">named</span><span class="pun">.</span><span class="pln">conf</span>
<span class="lit">23377</span><span class="pln"> </span><span class="lit">23375</span><span class="pln"> </span><span class="lit">2.3</span><span class="pln"> </span><span class="lit">0.2</span><span class="pln"> nginx</span><span class="pun">:</span><span class="pln"> worker process</span>
<span class="lit">23376</span><span class="pln"> </span><span class="lit">23375</span><span class="pln"> </span><span class="lit">2.1</span><span class="pln"> </span><span class="lit">0.1</span><span class="pln"> nginx</span><span class="pun">:</span><span class="pln"> worker process</span>
<span class="pln"> </span><span class="lit">3625</span><span class="pln"> </span><span class="lit">977</span><span class="pln"> </span><span class="lit">1.9</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">cgi </span><span class="pun">/</span><span class="pln">home</span><span class="pun">/</span><span class="pln">daygeekc</span><span class="pun">/</span><span class="pln">public_html</span><span class="pun">/</span><span class="pln">index</span><span class="pun">.</span><span class="pln">php</span>
<span class="lit">23375</span><span class="pln"> </span><span class="lit">1</span><span class="pln"> </span><span class="lit">1.7</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> nginx</span><span class="pun">:</span><span class="pln"> master process </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">sbin</span><span class="pun">/</span><span class="pln">nginx </span><span class="pun">-</span><span class="pln">c </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">.</span><span class="pln">conf</span>
<span class="lit">23378</span><span class="pln"> </span><span class="lit">23375</span><span class="pln"> </span><span class="lit">1.6</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> nginx</span><span class="pun">:</span><span class="pln"> cache manager process</span>
<span class="pln"> </span><span class="lit">1135</span><span class="pln"> </span><span class="lit">3034</span><span class="pln"> </span><span class="lit">0.9</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> cwpsrv</span><span class="pun">:</span><span class="pln"> worker process</span>
如果你只想查看命令名称而不是命令的绝对路径,请使用下面的 ps
命令格式。
<span class="com">#</span><span class="pln"> </span><span class="kwd">ps</span><span class="pln"> </span><span class="pun">-</span><span class="pln">eo pid</span><span class="pun">,</span><span class="pln">ppid</span><span class="pun">,%</span><span class="pln">mem</span><span class="pun">,%</span><span class="pln">cpu</span><span class="pun">,</span><span class="pln">comm </span><span class="pun">--</span><span class="kwd">sort</span><span class="pun">=-%</span><span class="pln">mem </span><span class="pun">|</span><span class="pln"> </span><span class="kwd">head</span>
<span class="pln"> PID PPID </span><span class="pun">%</span><span class="pln">MEM </span><span class="pun">%</span><span class="pln">CPU COMMAND</span>
<span class="pln"> </span><span class="lit">1064</span><span class="pln"> </span><span class="lit">1</span><span class="pln"> </span><span class="lit">5.4</span><span class="pln"> </span><span class="lit">3.2</span><span class="pln"> mysqld</span>
<span class="lit">23396</span><span class="pln"> </span><span class="lit">23386</span><span class="pln"> </span><span class="lit">2.9</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> cache</span><span class="pun">-</span><span class="pln">main</span>
<span class="pln"> </span><span class="lit">1105</span><span class="pln"> </span><span class="lit">1</span><span class="pln"> </span><span class="lit">2.7</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> named</span>
<span class="lit">23377</span><span class="pln"> </span><span class="lit">23375</span><span class="pln"> </span><span class="lit">2.3</span><span class="pln"> </span><span class="lit">0.2</span><span class="pln"> nginx</span>
<span class="lit">23376</span><span class="pln"> </span><span class="lit">23375</span><span class="pln"> </span><span class="lit">2.1</span><span class="pln"> </span><span class="lit">0.1</span><span class="pln"> nginx</span>
<span class="lit">23375</span><span class="pln"> </span><span class="lit">1</span><span class="pln"> </span><span class="lit">1.7</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> nginx</span>
<span class="lit">23378</span><span class="pln"> </span><span class="lit">23375</span><span class="pln"> </span><span class="lit">1.6</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> nginx</span>
<span class="pln"> </span><span class="lit">1135</span><span class="pln"> </span><span class="lit">3034</span><span class="pln"> </span><span class="lit">0.9</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> cwpsrv</span>
<span class="pln"> </span><span class="lit">1133</span><span class="pln"> </span><span class="lit">3034</span><span class="pln"> </span><span class="lit">0.9</span><span class="pln"> </span><span class="lit">0.0</span><span class="pln"> cwpsrv</span>
Linux 的 top
命令是用来监视 Linux 系统性能的最好和最知名的命令。它在交互界面上显示运行的系统进程的实时视图。但是,如果要查找内存消耗最大的进程,请 在批处理模式下使用 top 命令。
你应该正确地 了解 top 命令输出 以解决系统中的性能问题。
<span class="com">#</span><span class="pln"> </span><span class="kwd">top</span><span class="pln"> </span><span class="pun">-</span><span class="pln">c </span><span class="pun">-</span><span class="pln">b </span><span class="pun">-</span><span class="pln">o </span><span class="pun">+%</span><span class="pln">MEM </span><span class="pun">|</span><span class="pln"> </span><span class="kwd">head</span><span class="pln"> </span><span class="pun">-</span><span class="pln">n </span><span class="lit">20</span><span class="pln"> </span><span class="pun">|</span><span class="pln"> </span><span class="kwd">tail</span><span class="pln"> </span><span class="pun">-</span><span class="lit">15</span>
<span class="pln"> PID USER PR NI VIRT RES SHR S </span><span class="pun">%</span><span class="pln">CPU </span><span class="pun">%</span><span class="pln">MEM TIME</span><span class="pun">+</span><span class="pln"> COMMAND</span>
<span class="pln"> </span><span class="lit">1064</span><span class="pln"> mysql </span><span class="lit">20</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">886076</span><span class="pln"> </span><span class="lit">209740</span><span class="pln"> </span><span class="lit">8388</span><span class="pln"> S </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">5.4</span><span class="pln"> </span><span class="lit">62</span><span class="pun">:</span><span class="lit">41.20</span><span class="pln"> </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">sbin</span><span class="pun">/</span><span class="pln">mysqld</span>
<span class="lit">23396</span><span class="pln"> varnish </span><span class="lit">20</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">286492</span><span class="pln"> </span><span class="lit">115616</span><span class="pln"> </span><span class="lit">83572</span><span class="pln"> S </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">3.0</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">42.24</span><span class="pln"> </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">sbin</span><span class="pun">/</span><span class="pln">varnishd </span><span class="pun">-</span><span class="pln">P </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">run</span><span class="pun">/</span><span class="pln">varnish</span><span class="pun">.</span><span class="pln">pid </span><span class="pun">-</span><span class="pln">f </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">varnish</span><span class="pun">/</span><span class="kwd">default</span><span class="pun">.</span><span class="pln">vcl </span><span class="pun">-</span><span class="pln">a </span><span class="pun">:</span><span class="lit">82</span><span class="pln"> </span><span class="pun">-</span><span class="pln">T </span><span class="lit">127.0</span><span class="pun">.</span><span class="lit">0.1</span><span class="pun">:</span><span class="lit">6082</span><span class="pln"> </span><span class="pun">-</span><span class="pln">S </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">varnish</span><span class="pun">/</span><span class="pln">secret </span><span class="pun">-</span><span class="pln">s malloc</span><span class="pun">,</span><span class="lit">256M</span>
<span class="pln"> </span><span class="lit">1105</span><span class="pln"> named </span><span class="lit">20</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">311712</span><span class="pln"> </span><span class="lit">108204</span><span class="pln"> </span><span class="lit">2424</span><span class="pln"> S </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">2.8</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">16.41</span><span class="pln"> </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">sbin</span><span class="pun">/</span><span class="pln">named </span><span class="pun">-</span><span class="pln">u named </span><span class="pun">-</span><span class="pln">c </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">named</span><span class="pun">.</span><span class="pln">conf</span>
<span class="lit">23377</span><span class="pln"> nobody </span><span class="lit">20</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">153240</span><span class="pln"> </span><span class="lit">89432</span><span class="pln"> </span><span class="lit">2432</span><span class="pln"> S </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">2.3</span><span class="pln"> </span><span class="lit">4</span><span class="pun">:</span><span class="lit">35.74</span><span class="pln"> nginx</span><span class="pun">:</span><span class="pln"> worker process</span>
<span class="lit">23376</span><span class="pln"> nobody </span><span class="lit">20</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">147096</span><span class="pln"> </span><span class="lit">83316</span><span class="pln"> </span><span class="lit">2416</span><span class="pln"> S </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">2.1</span><span class="pln"> </span><span class="lit">2</span><span class="pun">:</span><span class="lit">18.09</span><span class="pln"> nginx</span><span class="pun">:</span><span class="pln"> worker process</span>
<span class="lit">23375</span><span class="pln"> root </span><span class="lit">20</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">131028</span><span class="pln"> </span><span class="lit">66764</span><span class="pln"> </span><span class="lit">1616</span><span class="pln"> S </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">1.7</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">01.07</span><span class="pln"> nginx</span><span class="pun">:</span><span class="pln"> master process </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">sbin</span><span class="pun">/</span><span class="pln">nginx </span><span class="pun">-</span><span class="pln">c </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">.</span><span class="pln">conf</span>
<span class="lit">23378</span><span class="pln"> nobody </span><span class="lit">20</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">130988</span><span class="pln"> </span><span class="lit">64592</span><span class="pln"> </span><span class="lit">592</span><span class="pln"> S </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">1.7</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">00.51</span><span class="pln"> nginx</span><span class="pun">:</span><span class="pln"> cache manager process</span>
<span class="pln"> </span><span class="lit">1135</span><span class="pln"> root </span><span class="lit">20</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">86708</span><span class="pln"> </span><span class="lit">37572</span><span class="pln"> </span><span class="lit">2252</span><span class="pln"> S </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">1.0</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">20.18</span><span class="pln"> cwpsrv</span><span class="pun">:</span><span class="pln"> worker process</span>
<span class="pln"> </span><span class="lit">1133</span><span class="pln"> root </span><span class="lit">20</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">86708</span><span class="pln"> </span><span class="lit">37544</span><span class="pln"> </span><span class="lit">2212</span><span class="pln"> S </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">1.0</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">05.94</span><span class="pln"> cwpsrv</span><span class="pun">:</span><span class="pln"> worker process</span>
<span class="pln"> </span><span class="lit">3034</span><span class="pln"> root </span><span class="lit">20</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">86704</span><span class="pln"> </span><span class="lit">36740</span><span class="pln"> </span><span class="lit">1452</span><span class="pln"> S </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">0.9</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">00.09</span><span class="pln"> cwpsrv</span><span class="pun">:</span><span class="pln"> master process </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">cwpsrv</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">cwpsrv</span>
<span class="pln"> </span><span class="lit">1067</span><span class="pln"> nobody </span><span class="lit">20</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">1356200</span><span class="pln"> </span><span class="lit">31588</span><span class="pln"> </span><span class="lit">2352</span><span class="pln"> S </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">0.8</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">56.06</span><span class="pln"> </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">apache</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">httpd </span><span class="pun">-</span><span class="pln">k start</span>
<span class="pln"> </span><span class="lit">977</span><span class="pln"> nobody </span><span class="lit">20</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">1356088</span><span class="pln"> </span><span class="lit">31268</span><span class="pln"> </span><span class="lit">2372</span><span class="pln"> S </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">0.8</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">30.44</span><span class="pln"> </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">apache</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">httpd </span><span class="pun">-</span><span class="pln">k start</span>
<span class="pln"> </span><span class="lit">968</span><span class="pln"> nobody </span><span class="lit">20</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">1356216</span><span class="pln"> </span><span class="lit">30544</span><span class="pln"> </span><span class="lit">2348</span><span class="pln"> S </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">0.8</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">19.95</span><span class="pln"> </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">apache</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">httpd </span><span class="pun">-</span><span class="pln">k start</span>
如果你只想查看命令名称而不是命令的绝对路径,请使用下面的 top
命令格式。
<span class="com">#</span><span class="pln"> </span><span class="kwd">top</span><span class="pln"> </span><span class="pun">-</span><span class="pln">b </span><span class="pun">-</span><span class="pln">o </span><span class="pun">+%</span><span class="pln">MEM </span><span class="pun">|</span><span class="pln"> </span><span class="kwd">head</span><span class="pln"> </span><span class="pun">-</span><span class="pln">n </span><span class="lit">20</span><span class="pln"> </span><span class="pun">|</span><span class="pln"> </span><span class="kwd">tail</span><span class="pln"> </span><span class="pun">-</span><span class="lit">15</span>
<span class="pln"> PID USER PR NI VIRT RES SHR S </span><span class="pun">%</span><span class="pln">CPU </span><span class="pun">%</span><span class="pln">MEM TIME</span><span class="pun">+</span><span class="pln"> COMMAND</span>
<span class="pln"> </span><span class="lit">1064</span><span class="pln"> mysql </span><span class="lit">20</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">886076</span><span class="pln"> </span><span class="lit">210340</span><span class="pln"> </span><span class="lit">8388</span><span class="pln"> S </span><span class="lit">6.7</span><span class="pln"> </span><span class="lit">5.4</span><span class="pln"> </span><span class="lit">62</span><span class="pun">:</span><span class="lit">40.93</span><span class="pln"> mysqld</span>
<span class="lit">23396</span><span class="pln"> varnish </span><span class="lit">20</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">286492</span><span class="pln"> </span><span class="lit">115616</span><span class="pln"> </span><span class="lit">83572</span><span class="pln"> S </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">3.0</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">42.24</span><span class="pln"> cache</span><span class="pun">-</span><span class="pln">main</span>
<span class="pln"> </span><span class="lit">1105</span><span class="pln"> named </span><span class="lit">20</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">311712</span><span class="pln"> </span><span class="lit">108204</span><span class="pln"> </span><span class="lit">2424</span><span class="pln"> S </span><span class="lit">0.0</span><span class="pln"> </span><span class="lit">2.8</span><span class="pln"> </span><span class="lit">0</span><span class="pun">:</span><span class="lit">16.41</span><span class="pln"> named</span>
<span class="lit">23377</span><span class="pln"> nobody </span><span class="lit">20</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">153240</span><span class="pln"> </span><span class="lit">89432</span><span class="pln"> </span><span class="lit">2432</span><span class="pln"> S </span><span class="lit">13.3</span><span class="pln"> </span><span class="lit">2.3</span><span class="pln"> </span><span class="lit">4</span><span class="pun">:</span><span class="lit">35.74</span><span class="pln"> nginx</span>
<span class="lit">23376</span><span class="pln"> nobody </span><span class="lit">20</span><span class="pln"> &l