linux ps查看完整时间,Linux ps 命令查看进程启动及运行时间

引言

同事问我怎样看一个进程的启动时间和运行时间,我第一反应当然是说用 ps 命令啦。

ps aux或ps -ef不就可以看时间吗?

ps aux选项及输出说明

我们来重新复习下ps aux的选项,这是类 BSD 风格的命令选项,因为不带“-”。

通过 man 可以看到 aux 选项解释如下:

a Lift the BSD-style "only yourself" restriction, which is imposed upon the set of all processes

when some BSD-style (without "-") options are used or when the ps personality setting is BSD-like.

The set of processes selected in this manner is in addition to the set of processes selected by other means.

An alternate description is that this option causes ps to list all processes with a terminal (tty),

or to list all processes when used together with the x option.

x Lift the BSD-style "must have a tty" restriction, which is imposed upon the set of all processes

when some BSD-style (without "-") options are used or when the ps personality setting is BSD-like.

The set of processes selected in this manner is in addition to the set of processes selected by other means.

An alternate description is that this option causes ps to list all processes owned by you (same EUID as ps),

or to list all processes when used together with the a option.

u Display user-oriented format.

然后再来看下ps aux的输出结果,其首行如下,说明了输出的各列:

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND

我们可以看到START和TIME列,通过 man 其说明如下:

bsdstart START time the command started.

If the process was started less than

你可能感兴趣的:(linux,ps查看完整时间)