如何检索命令行参数

bot*_*t47 12 command-line command-line-arguments macos

如何查看传递给 Mac OS X 上正在运行的进程的命令行参数?

slh*_*hck 14

通过终端运行一个正常的进程列表:

ps auxww
Run Code Online (Sandbox Code Playgroud)

这些ww选项是用于广泛列表的 BSD 语法。您还可以使用:

ps -ef
Run Code Online (Sandbox Code Playgroud)

对于现在常用的 POSIX 语法。

示例输出,您可以在其中查看各种进程的参数:

USER       PID  %CPU %MEM      VSZ    RSS   TT  STAT STARTED      TIME COMMAND
werner   22208   3.8  0.1   187288   4692   ??  SN    2May12 373:03.43 CocoaDialog progressbar --indeterminate --title LaTeX Watch --text LaTeX Watch: Compiling document
werner    9860   3.0  1.9   694776 161780   ??  S    Fri06PM  26:18.32 /Applications/Skype.app/Contents/MacOS/Skype -psn_0_133185276
werner    9791   2.4  0.4  2918396  30876   ??  S    Fri06PM   0:19.30 /Applications/iTerm.app/Contents/MacOS/iTerm -psn_0_133144306
werner    9718   2.2  0.8   531556  67940   ??  S    Fri06PM  24:10.68 /Applications/Google Drive.app/Contents/MacOS/Google Drive -psn_0_132955844
_windowserver  9663   1.9  1.7  3297256 144764   ??  Ss   Fri06PM  16:48.69 /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Resources/WindowServer -daemon
Run Code Online (Sandbox Code Playgroud)