44

How can I read top in bash only for one user? I don't want it to display data for other users.

2 Answers 2

57

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.

2
  • By the way, as of v1.33.1, this does not work with busybox's top. Dec 1, 2021 at 4:39
  • 2
    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" Jan 28, 2022 at 18:39
1

If you already started top, you can also press the u key and enter the username in the status line.

In case you want to show all users again (make the selection undone), press the = key or respectively the + key to clear the selection criteria in all top windows.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .