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.

  • 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 2 '19 at 7:59
1

If I understand you correctly, would this help?

top | grep -ve "user1" -e "user2"
|improve this answer|||||
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...

|improve this answer|||||
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.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.