In 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?
4 Answers
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.

- 370
- 3
- 11
-
3Please note this works on the more recent versions of `top`. 3.3.9 has it, while 3.2.8 hasn't. – Deer Hunter Sep 04 '14 at 11:52
-
3Oddly enough, on Ubuntu 14.04, I needed to use `-u` instead of `-U`. – muru Sep 20 '16 at 21:22
-
4I had to use `top -u '!root'` to NOT get the `!` to be interpreted by the shell (I believe that is what is happening w/o the single quotes). – steveb Dec 30 '16 at 22:09
-
1Interactively you can type `u` and then `!root` – DrBeco Apr 12 '17 at 05:22
-
2Better yet, add a filter to exclude all system users, like `O` and filter `RUID>999`. You need to add `RUID` column first. – DrBeco Apr 12 '17 at 06:00
-
`sudo top -u '!root'` worked for me – user1156544 Oct 23 '18 at 15:50
Also, as of version 3.3, you can just type u
while top
is running and enter that !root
string.

- 41
- 1
top -U root
shows only processes from root. Unfortunately that is the only option for limiting users according to the man page.

- 3,017
- 17
- 15
-
But if you wanted to deviate from using top, you could do `ps aux | grep -v $USERNAME` to see all processes except the user you specified. – Tim Jan 06 '12 at 18:14
-
Thanks. I know those two commands. I've searched around but didn't find anyone ask about this. top -u can see one user, but I want to see more users in real-time. – garconcn Jan 06 '12 at 18:22
-
4
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 o!USER=root<enter>o!USER=nobody
.
Many interesting views are possible with this filtering option!

- 221
- 1
- 2
-
I think this is the only answer that answers the question: "exclude some users (for example, root and nobody)", i.e. excluding more than one user. Perhaps this wasn't possible in 2012. – Ramashalanka Mar 05 '19 at 22:56