如何检查OS X终端中的进程?

Sun*_*day 64 macos terminal process ps

我想查看在OS X中运行的进程的信息.ps在终端中运行只列出打开的终端窗口.如何查看正在运行的所有进程?

假设我正在运行Web浏览器,终端和文本编辑器.我想查看文本编辑器和Web浏览器的信息.

Sun*_*day 61

跑步ps -e就行了.在这里找到答案.

  • 使用`kill [PID]`aka`shill 83132`来杀死所需的进程. (3认同)
  • `ps -e`加上`grep`就是我所需要的. (2认同)

cam*_*o_u 47

您可以使用top 它将显示您的OSX上运行的所有内容

  • 运行`top`只显示足够的进程来填充屏幕.它不显示"一切正在运行".我怎么看到一个不在"顶部"可见区域的过程 (12认同)
  • Jeff,如果你想要完整的列表,你可以使用`ps aux`或者你可以在打开顶部时对进程列表进行排序,例如:按内存使用情况排序:`top -o rsize`按CPU使用情况排序:`top -o cpu`这不完全是整个列表, (2认同)

Jak*_*uld 43

使用top并且ps没问题,但我发现使用htop它比Mac OS X使用的标准工具更好更清晰.我最喜欢的用途是在T键盘运行时查看键以查看树视图中的进程(参见屏幕截图).显示哪些进程与其他进程共同依赖.

OSX上的htop

您可以使用以下方法从Homebrew安装它:

brew install htop
Run Code Online (Sandbox Code Playgroud)

如果你git的系统上安装了Xcode和相关工具,并且你想从官方源代码库安装最新的开发代码 - 请遵循以下步骤.

首先从htopGitHub存储库克隆源代码:

git clone git@github.com:hishamhm/htop.git
Run Code Online (Sandbox Code Playgroud)

现在进入存储库目录:

cd htop
Run Code Online (Sandbox Code Playgroud)

运行autogen.sh:

./autogen.sh
Run Code Online (Sandbox Code Playgroud)

运行此configure命令:

./configure
Run Code Online (Sandbox Code Playgroud)

configure完成该过程后,运行make:

make
Run Code Online (Sandbox Code Playgroud)

最后通过运行安装它sudo make install:

sudo make install
Run Code Online (Sandbox Code Playgroud)


Dav*_*ave 19

试试ps -ef.man ps会给你所有的选择.

 -A      Display information about other users' processes, including those without controlling terminals.

 -e      Identical to -A.

 -f      Display the uid, pid, parent pid, recent CPU usage, process start time, controlling tty, elapsed CPU usage, and the associated command.  If the -u option is also used, display
         the user name rather then the numeric uid.  When -o or -O is used to add to the display following -f, the command field is not truncated as severely as it is in other formats.
Run Code Online (Sandbox Code Playgroud)


Mac*_*ade 7

尝试top命令.它是一个交互式命令,将显示正在运行的进程.

您也可以使用Apple的"活动监视器"应用程序(位于/Applications/Utilities/).

它提供了一个非常好的GUI.您可以查看所有正在运行的进程,由用户过滤它们,获取有关它们的扩展信息(CPU,内存,网络等),监视它们等等...

可能是你最好的选择,除非你想坚持使用终端(在这种情况下,请阅读topps手册,因为这些命令有很多选项).