I'm trying to clarify how the ps command works, especially using the -e and -u flags together. A Linux engineer mentioned that our user, bobthebuilder, has a lot of processes running on a server. When I ran `ps -eT -u bobthebuilder | wc -l`, I got a count of 4109 processes. My concern is whether combining -e for all processes and -u for the specific user really filters correctly, because I noticed that it returned some root and daemon processes as well. Isn't that a bit misleading? I usually separate the two commands to avoid such confusion.
3 Answers
You're spot on to be skeptical! When you run `ps -eT -u nobody`, you can clearly see processes that aren’t owned by that user. So, your thought that the total count may not accurately reflect just the user's processes is valid.
Check out our wiki for more resources on this! Understanding each part of the ps command is key, and practicing in a VM can help solidify your knowledge. Remember to always back up your data and verify commands before running them!
Great question! According to the man page for ps, the -e flag lists all processes, while -T focuses on those associated with the terminal. So when combined, it can pull back results that don't pertain to the specified user with -u. This might explain the discrepancies you're noticing.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures