Linux中使用ps查看进程启动的精确时间和启动后所流逝的时间

ps命令中其实提供了相应参数,使用man ps查看(养成linux命令行下查看man手册的习惯)

话不多说,直接上命令。


[root@test root]# ps -eo pid,lstart,etime,cmd | grep nginx       

  336 Fri Aug 17 14:00:13 2018 311-01:29:08 nginx: master process /opt/app/tengine/sbin/nginx

 1583 Sun Jun 23 00:00:00 2019  1-15:29:21 nginx: worker process is shutting down

13412 Mon Jun 24 00:00:00 2019    15:29:21 nginx: worker process

13413 Mon Jun 24 00:00:00 2019    15:29:21 nginx: worker process

21087 Mon Jun 24 15:29:21 2019       00:00 grep --color=auto nginx

22198 Sat Jun 22 00:00:00 2019  2-15:29:21 nginx: worker process is shutting down


命令解析:

-e          显示所有进程

-o          自定义显示格式

pid        显示进程ID

lstart     进程启动时间的精确时间(长格式显示)

etime    进程启动后至今所流逝的时间

cmd      显示进程启动的命令


猜你喜欢

转载自blog.51cto.com/kusorz/2412778