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列均值为所有行?还有C和CMD列代表什么?
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是?,则表示该进程不与任何用户终端关联。
小智 6
UID PID PPID C STIME TTY TIME CMD
\n根 1 0 0 2012 ?00:00:01 初始化 [3]
\n了解输出:-
\n启动该进程的用户的名称。
\n这一列是PID,即进程ID。它作为内存中运行的进程的标识号。
\n这一列是PPID,即父进程ID。该 id 是进程的 pid,这些进程由此启动。所有Oracle进程都没有\xe2\x80\x99t有父进程,因此被init进程采用,init进程的pid为1,因此所有oracle进程的ppid将为1。
\n处理器利用率信息(以百分比表示)。
\n这是进程的启动时间,对于长时间运行的进程(例如 Oracle),它将仅显示进程启动的日期。如果您想知道单独运行的进程的全年和时间,请使用此选项触发命令\nps \xe2\x80\x93efo user, pid, ppid, etime, args \xe2\x80\x93 etime 将告诉你最后如何进程已经运行很多天了。
\n这是启动该进程的终端。正如在终端 pts/2 中触发 grep pmon 命令的情况一样,因此它表明该进程是由终端 pts/2 启动的。所有的oracle进程都不是由任何终端启动的。
\n进程使用 CPU 的总时间。
\n执行的命令和参数。
\n