请解释 ps -ef 命令的这个输出?

Gee*_*eek 22 process ps command controlling-terminal

ps -ef命令的部分输出如下所示:

UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0  2012 ?        00:00:01 init [3]         
root         2     1  0  2012 ?        00:00:01 [migration/0]
root         3     1  0  2012 ?        00:00:00 [ksoftirqd/0]
root         4     1  0  2012 ?        00:00:00 [watchdog/0]
root         5     1  0  2012 ?        00:00:00 [events/0]
root         6     1  0  2012 ?        00:00:00 [khelper]
root         7     1  0  2012 ?        00:00:00 [kthread]
root         9     7  0  2012 ?        00:00:00 [xenwatch]
root        10     7  0  2012 ?        00:00:00 [xenbus]
root        18     7  0  2012 ?        00:00:01 [migration/1]
root        19     7  0  2012 ?        00:00:00 [ksoftirqd/1]
Run Code Online (Sandbox Code Playgroud)

什么是 "?"在TTY列均值为所有行?还有CCMD列代表什么?

Kar*_*son 26

您可以查看联机帮助页man ps以了解列的含义。ps例如,Linux联机帮助页提供:

c              C           integer value of the processor utilisation percentage.
                           (see %cpu)
tname          TTY         controlling tty (terminal). (alias tt, tty).
args           COMMAND     command with all its arguments as a string. May chop as
                           desired. Modifications to the arguments are not shown.
                           The output in this column may contain spaces.
                           (alias cmd, command)
cmd            CMD         see args. (alias args, command)
Run Code Online (Sandbox Code Playgroud)

如果TTY?,则表示该进程不与任何用户终端关联。

  • `man ps` 应该适用于任何地方,而不仅仅是 Linux。将编辑您的答案以说出我认为您的意思;如果我犯了错误,请随时回复。 (2认同)

Cha*_*oyd 6

由于这些都是内核进程,因此它们不附加到 TTY(因此是?TTY字段中的值)。


小智 6

UID PID PPID C STIME TTY TIME CMD

\n

根 1 0 0 2012 ?00:00:01 初始化 [3]

\n

了解输出:-

\n
    \n
  1. 启动该进程的用户的名称。

    \n
  2. \n
  3. 这一列是PID,即进程ID。它作为内存中运行的进程的标识号。

    \n
  4. \n
  5. 这一列是PPID,即父进程ID。该 id 是进程的 pid,这些进程由此启动。所有Oracle进程都没有\xe2\x80\x99t有父进程,因此被init进程采用,init进程的pid为1,因此所有oracle进程的ppid将为1。

    \n
  6. \n
  7. 处理器利用率信息(以百分比表示)。

    \n
  8. \n
  9. 这是进程的启动时间,对于长时间运行的进程(例如 Oracle),它将仅显示进程启动的日期。如果您想知道单独运行的进程的全年和时间,请使用此选项触发命令\nps \xe2\x80\x93efo user, pid, ppid, etime, args \xe2\x80\x93 etime 将告诉你最后如何进程已经运行很多天了。

    \n
  10. \n
  11. 这是启动该进程的终端。正如在终端 pts/2 中触发 grep pmon 命令的情况一样,因此它表明该进程是由终端 pts/2 启动的。所有的oracle进程都不是由任何终端启动的。

    \n
  12. \n
  13. 进程使用 CPU 的总时间。

    \n
  14. \n
  15. 执行的命令和参数。

    \n
  16. \n
\n