小编nom*_*nom的帖子

如何在没有“root”进程的情况下通过 top 显示进程的 CPU 时间

好的,所以我已经尝试了大约三个小时但没有成功。

你如何搜索/显示/使用top命令(或ps命令,如果它有效......)输出所有进程的列表,按 CPU 时间排序,不包括“root”拥有的进程。

我到目前为止的尝试:

top -b -S -n 1 | grep -v root
top -b -S -n 1 | egrep -ve root

ps -eo pid,user,args,etime,time,%cpu --sort etime | egrep -v root
Run Code Online (Sandbox Code Playgroud)

那以及在批处理模式下运行 top 的各种尝试,输出到文件并尝试awk/grep/sort通过它并根据 CPU 时间量对其进行正确排序(大多数情况下无法找到正确的列/设法以任何看似有用的方式对正确的列进行排序)。

如果这看起来有点混乱,请原谅我;tl;博士:

我只是想要一些方法来轻松阅读 top 而无需 root procs 并按 CPU 时间排序。

grep top ps awk sort

3
推荐指数
1
解决办法
9901
查看次数

标签 统计

awk ×1

grep ×1

ps ×1

sort ×1

top ×1