3

I'm trying to use the top command and exclude two users from showing in the iteration I'm sending to the textfile.

I have used the -u='!user' command-line option, but I can only exclude 1 user with it and am not able to use the option more than once.

I found a suggestion to use the command:

o!USER=user <enter> o!USER=user

but I'm fairly lost in how to implement it without getting an error.

undercat
  • 1,857
  • Are you using top on Linux or on BSD or some other type of UNIX system? Implementations of top vary quite significantly, and they have different capabilities for filtering. – Kusalananda Oct 02 '19 at 07:59

3 Answers3

6

It works if you add one filter after another.

Run top and add a filter for the first user. Press o and enter

!USER=user1

, then press o and add the next filter

!USER=user2

and so forth...

Freddy
  • 25,565
2

If it were only one user, you could do

top -U '!user1'

The -U filters by real user id, whereas -u filters by effective user id.

I could not get multiple users to be filtered with this method.

Woodsman
  • 139
  • 6
1

If I understand you correctly, would this help?

top | grep -ve "user1" -e "user2"