使用 ps 命令查看进程启动的精确时间和启动后所流逝的时间
回到引言中的问题,同事实际要问的是一个进程启动的精确时间和进程启动后所流逝的时间。
其实这 2 个时间也是可以通过 ps 命令输出的。 标识符如下:
lstart STARTED time the command started. See also bsdstart, start, start_time, and stime.
etime ELAPSED elapsed time since the process was started, in the form [[DD-]hh:]mm:ss.
例子:
查看 nginx 进程启动的精确时间和启动后所流逝的时间:
[root@iZ25p102vo3Z ~]# ps -eo pid,lstart,etime,cmd | grep nginx
16968 Fri Mar 4 16:04:27 2016 41-21:14:04 nginx: master process /usr/sbin/nginx
17826 Fri Mar 4 22:53:51 2016 41-14:24:40 nginx: worker process
18312 Fri Apr 15 13:18:31 2016 00:00 grep --color=auto nginx
本文介绍了如何通过ps命令获取Linux系统中进程的启动精确时间和已运行时间。示例展示了如何查找nginx进程的启动日期和流逝时间,输出包括PID、启动时间(lstart)和已运行时间(etime)等信息。
1046

被折叠的 条评论
为什么被折叠?



