When I type ps -ef , there are lots of special kernel thread processes showing.I am not interested in kernel threads; I am only interested in user process/thread.Is there a way that I can hide the kernel threads?
Is there any way to hide kernel threads from ps command results?
linux kernel;ps;proc;utilities
ps output can be filtered in may ways. To see your processes, you could filter by the user/uid. relevant man page below --   U userlist      Select by effective user ID (EUID) or name.                   This selects the processes whose effective user name or ID is in userlist. The effective user ID describes the user                   whose file access permissions are used by the process (see geteuid(2)). Identical to -u and --user.   -U userlist     Select by real user ID (RUID) or name.                   It selects the processes whose real user name or ID is in the userlist list. The real user ID identifies the user                   who created the process, see getuid(2).   -u userlist     Select by effective user ID (EUID) or name.                   This selects the processes whose effective user name or ID is in userlist. The effective user ID describes the user                   whose file access permissions are used by the process (see geteuid(2)). Identical to U and --user.To identify kernel vs user threads, it may depend on the kernel version. On my ubuntu machine (3.5.0-30-generic), I can exclude kernel threads by excluding children of kthreadd (pid =2). The pid of kthreadd may differ on 2.6 kernels - however, you could just use the relevant pid. As an example, to get a list of all processes that dont have ppid =2, I do (for options to feed to -o, check the man page)-- ps -o pid,ppid,comm,flags,%cpu,sz,%mem  --ppid 2 -NYou could also filter these using grep or awk. The other way (not using ps) to identify kernel threads is to check whether /proc//maps or /proc/cmdline is empty - both are empty for kernel threads. You'll need root privileges to do this.