4

I check the manual of ps, and it said -e will list all processes, while -u will list processes for a specific user.

So I try to use ps -eu myaccount | wc -l and it outputs 280.

But if I use ps -u myaccount | wc -l and it outputs 12.

Since both are used to output all the processes for the user myaccount, why the result will be different?

10

A better question would be "What's the difference between ps -e and ps -eu" and the answer would be "nothing".

The -e option shows all processes, and basically replaces the -u selection.

As pointed out by @fra-san, the man page indicates all process selection options are additive. The -u option selects, not filters, and you can't add any more processes after -e as they are already all there.

1
  • 1
    It is also worth to note that on a multiprocess system, which Unix-like systems are, the number of processes might differ between two invocations of ps. Also the header line will be counted by wc. Oct 22 '21 at 10:22

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.