How can I read top in bash only for one user? I don't want it to display data for other users.
Asked
Active
Viewed 6.5k times
40
detraveller
- 935
- 2
- 9
- 14
1 Answers
53
From man top:
-u : Monitor by user as: -u somebody
Monitor only processes with an effective UID or user name matching
that given.
So, if you run top -u root you'll get only root processes.
m0nhawk
- 3,643
- 3
- 23
- 25
-
By the way, as of v1.33.1, this does not work with busybox's top. – Aaron Mason Dec 01 '21 at 04:39
-
In a **running** instance of `top`, press `u` to filter processes by user. From the help (use `?` to show it): "u,U,o,O . Filter by: 'u'/'U' effective/any user; 'o'/'O' other criteria" – Matthias Braun Jan 28 '22 at 18:39