没有内核线程的“ps”

Naj*_*kon 4 linux shell linux-kernel

我正在寻找一些解决方案来使用ps auxf命令来显示没有内核线程的所有进程,或者也许有人知道任何其他程序来过滤该内核进程?

我尝试并发现的内容:

ps --ppid 2 -p 2 --deselect
Run Code Online (Sandbox Code Playgroud)

好的,但是进程不像通常的“ps aux”那样安排:

ps axl | awk '$7 != 0 && $10 !~ "Z"'
Run Code Online (Sandbox Code Playgroud)

结果更加混乱

ps auxf | grep -v ]$
Run Code Online (Sandbox Code Playgroud)

在我看来,在这个标志之后切断是一个愚蠢的解决方案。有'[]'的正常进程

如果有一个像-k -- show kernel threads:)这样的开关就好了,任何其他选项都只会显示以 Init 开头的系统进程。那么,使用ps auxorps auxf会更方便。

有人吗?某物?知道任何更好的解决方案。

hek*_*mgl 6

它是定义输出列的uin ps aux。您可以使用:

ps u --ppid 2 -p 2 --deselect
Run Code Online (Sandbox Code Playgroud)