2013-02-27 82 views

回答

4

试着这样做:

top -b -n1 -c 

如果你想,是以最%的CPU时间的过程:

top -b -n1 -c | awk '/PID *USER/{print;getline;print}' 

top -b -n1 -c | grep -A 2 '^$' 
+0

在我的系统上,最后两个命令一直给我'顶部'作为使用最多CPU的命令:) – Thomas 2016-08-22 11:50:48

14

,或者使用一些其他的utils的你可以这样做:

ps aux | sort -rk 3,3 | head -n 5 

更改头的值以获取要查看的进程数。

+0

这可以只是'ps aux --sort = -pcpu | head -n5',但如果你想使用排序,你应该包含'-n'(数字)选项,否则'6.5'将会高于'32.5'。否则,谢谢! – mVChr 2017-03-13 20:16:43