top screen, by default it shows all users' processes. How to exclude some users(for example, root and nobody) from the top real-time screen?
The correct answer is:
-U '!root' (or
-u '!root' on some Ubuntus). This was introduced in top v3.2.9:
man top for -U option:
Prepending an exclamation point ('!') to the user id or name instructs top to display only processes with users not matching the one provided.
Remember to put the exclamation mark and username in single quotes.
Also, as of version 3.3, you can just type
top is running and enter that
top -U root shows only processes from root. Unfortunately that is the only option for limiting users according to the man page.
As suggested by Dr Beco above the most general filtering mechanism uses 'o/O' to activate "Other Filtering" while in
top to exclude/include more than one user.
For example to exclude "root" and "nobody" one can use the command
Many interesting views are possible with this filtering option!