为什么我的Mac终端的ps -u无法正常工作? [英] Why is my mac terminal's ps -u not working?

查看:165
本文介绍了为什么我的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周围的变体有些差异.因此,几个命令可能具有不同的标志.我认为ps-u标志在两个变体上都是相同的,但是通常,在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天全站免登陆