Sarah Cohen
Sarah Cohen

Reputation: 726

Why is my mac terminal's ps -u not working?

I am learning the Linux ps command and its possible arguments. My tutorial told me about the -u argument and I am trying to use it.

No matter if I use it alone or with other args, it is throwing errors.

I am inserting a picture of the output I keep receiving. I'm not sure if this is something to do with my Mac's terminal/shell, or if I am missing something that I should be typing.

It seems to be telling me to use two hyphens, --u, instead of one, -u, but it gives me the same issue. If I JUST have ps u, the terminal gives me the output, but if I try adding an f, fu, or f u, or -fu, the same issue occurs again.

Am I doing something wrong? I am just confused at this point how this all works and why I am not getting the output that all the tutorials are showing, with the same commands and args.

Upvotes: 2

Views: 4040

Answers (1)

wmorrell
wmorrell

Reputation: 5307

In this case, ps is expecting the -u flag to be followed with a username. So the command to use would be, e.g. ps -u anotheruser.

The Mac is based off of a BSD-variant of UNIX, which has some differences from the variants that grew up around GNU/Linux. So several commands may have different flags. I think the -u flag to ps is the same on both variants, but in general it's best to check the manpage for the command when following a Linux tutorial on Mac, or vice versa: man ps.

Upvotes: 2

Related Questions