【问题标题】:How can I get process command line from PowerShell Core on Ubuntu?如何从 Ubuntu 上的 PowerShell Core 获取进程命令行?
【发布时间】:2020-01-12 12:52:36
【问题描述】:

我在 Ubuntu 18.04 服务器上。我知道ps auxww 可以获取完整的命令行信息。例如,通过运行ps auxww,我知道命令/usr/local/bin/my-program -parameter :8888 正在运行。如何从 PowerShell 获取相同的信息?我四处搜索,所有信息都是关于如何在 Windows 上获取命令行信息。

【问题讨论】:

  • 我不认识自己,除非使用 /bin/ls。

标签: powershell command-line process ubuntu-18.04 powershell-core


【解决方案1】:

在 Ubuntu 18.04 PowerShell 上

你试过ps -a -F。它应该提供您正在寻找的详细信息。

如果需要有关正在运行/所有进程的特定详细信息,请尝试使用更多选项

ps --help allps --help output 命令

PS> ps --help output   

Usage:
 ps [options]

Basic options:
 -A, -e               all processes
 -a                   all with tty, except session leaders
  a                   all with tty, including other users
 -d                   all except session leaders
 -N, --deselect       negate selection
  r                   only running processes
  T                   all processes on this terminal
  x                   processes without controlling ttys

Output formats:
 -F                   extra full
 -f                   full-format, including command lines
  f, --forest         ascii art process tree
 -H                   show process hierarchy
 -j                   jobs format
  j                   BSD job control format
 -l                   long format
  l                   BSD long format
 -M, Z                add security data (for SELinux)
 -O <format>          preloaded with default columns
  O <format>          as -O, with BSD personality
 -o, o, --format <format>
                      user-defined format
  s                   signal format
  u                   user-oriented format
  v                   virtual memory format
  X                   register format
 -y                   do not show flags, show rss vs. addr (used with -l)
     --context        display security context (for SELinux)
     --headers        repeat header lines, one per page
     --no-headers     do not print header at all
     --cols, --columns, --width <num>
                      set screen width
     --rows, --lines <num>
                      set screen height
        --help <simple|list|output|threads|misc|all>
                      display help and exit

For more details see ps(1).

【讨论】:

  • 这仍然只是 ps 命令。我认为 OP 正在使用 Get-Process 寻找答案。
猜你喜欢
  • 2013-07-07
  • 1970-01-01
  • 1970-01-01
  • 2012-02-25
  • 1970-01-01
  • 2011-02-02
  • 1970-01-01
  • 2012-10-28
相关资源
最近更新 更多