Linux: is it possible to see only kernel space threads/process?
Kernel processes (or "kernel threads") are children of PID 2 (kthreadd
), so this might be more accurate:
ps --ppid 2 -p 2 -o uname,pid,ppid,cmd,cls
Add --deselect
to invert the selection and see only user-space processes.
(This question was pretty much an exact inverse of this one.)
In 2.4.* and older kernels, this PID 2 convention did not exist yet.
Kernel threads do not use RAM at all (or at least are displayed not to use any):
ps -eo cmd,vsize,rss | grep -E ' 0 +0$'