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

北城余情 提交于 2020-01-16 02:26:26

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/49738806/why-is-my-mac-terminals-ps-u-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!