为什么我的 mac 终端的 ps -u 不起作用? [英] Why is my mac terminal's ps -u not working?

查看:31
本文介绍了为什么我的 mac 终端的 ps -u 不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习 Linux ps 命令及其可能的参数.我的教程告诉我 -u 参数,我正在尝试使用它.

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.

我正在插入我一直收到的输出图片.我不确定这是否与我的 Mac 的终端/外壳有关,或者我是否遗漏了我应该输入的内容.

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.

它似乎告诉我使用两个连字符 --u,而不是一个,-u,但它给了我同样的问题.如果我只有 ps u,终端会给我输出,但如果我尝试添加 f、fu 或 f u 或 -fu,同样的问题再次发生.

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.

推荐答案

在这种情况下,ps 期望 -u 标志后跟一个用户名.所以要使用的命令是,例如ps -u anotheruser.

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.

Mac 基于 UNIX 的 BSD 变体,它与围绕 GNU/Linux 发展起来的变体有一些不同.所以几个命令可能有不同的标志.我认为 -u 标志到 ps 在两个变体上是相同的,但一般来说,在 Mac 上遵循 Linux 教程时,最好检查命令的联机帮助页,或者反之亦然:man ps.

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.

这篇关于为什么我的 mac 终端的 ps -u 不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆