首页 > 系统相关 >Linux ps -o 查看进程启动时间

Linux ps -o 查看进程启动时间

时间:2023-07-21 21:47:52浏览次数:38  
标签:ps 01 20 21 查看 process 37 nginx Linux

时间参数


  • 如下表
    参数    含义
    start 显示进程启动时间的简短格式。通常,它会显示日期时间中的月-日 或者 时-分-秒
    start_time  显示进程启动时间的简短格式,通常格式是 年 或者  月-日 或者  时-分,没有秒
    etime 显示进程启动的累积时间,通常格式是 天-时-分-秒
    etimes 显示进程启动的累积时间,通常格式是以秒为单位
    lstart 显示进程的启动时间的长格式,通常格式是 星期-月-日 时-分-秒 年
    stime 表示进程在内核态(Kernel Mode)运行的累计时间。内核态是指进程在执行系统调用或其他内核相关操作时所处的运行模式,通常格式是 年 或者  月-日 或者  时-分,没有秒

 

具体使用方法


  1. 执行命令
    [21:34:37] root@test-b5-nginx-33-102:/etc/tengine # ps -eo pid,start,lstart,%cpu,start_time,etime,cmd | head -n 1 && ps -eo pid,start,lstart,%cpu,start_time,etime,cmd  | grep nginx
      PID  STARTED                  STARTED %CPU START     ELAPSED CMD
     4470 20:37:01 Fri Jul 21 20:37:01 2023  0.2 20:37    01:00:17 nginx: worker process
     4471 20:37:01 Fri Jul 21 20:37:01 2023  0.1 20:37    01:00:17 nginx: worker process
     4472 20:37:01 Fri Jul 21 20:37:01 2023  0.2 20:37    01:00:17 nginx: worker process
     4473 20:37:01 Fri Jul 21 20:37:01 2023  0.3 20:37    01:00:17 nginx: worker process
     4474 20:37:01 Fri Jul 21 20:37:01 2023  0.2 20:37    01:00:17 nginx: worker process
     4475 20:37:01 Fri Jul 21 20:37:01 2023  0.2 20:37    01:00:17 nginx: worker process
     4476 20:37:01 Fri Jul 21 20:37:01 2023  0.2 20:37    01:00:17 nginx: worker process
     4477 20:37:01 Fri Jul 21 20:37:01 2023  0.2 20:37    01:00:17 nginx: worker process
     4478 20:37:01 Fri Jul 21 20:37:01 2023  0.2 20:37    01:00:17 nginx: worker process
     4479 20:37:01 Fri Jul 21 20:37:01 2023  0.2 20:37    01:00:17 nginx: worker process
     4480 20:37:01 Fri Jul 21 20:37:01 2023  0.2 20:37    01:00:17 nginx: worker process
     4481 20:37:01 Fri Jul 21 20:37:01 2023  0.1 20:37    01:00:17 nginx: worker process
     4482 20:37:01 Fri Jul 21 20:37:01 2023  0.2 20:37    01:00:17 nginx: worker process
     4483 20:37:01 Fri Jul 21 20:37:01 2023  0.3 20:37    01:00:17 nginx: worker process
     4484 20:37:01 Fri Jul 21 20:37:01 2023  0.2 20:37    01:00:17 nginx: worker process
     4485 20:37:01 Fri Jul 21 20:37:01 2023  0.2 20:37    01:00:17 nginx: worker process
     4486 20:37:01 Fri Jul 21 20:37:01 2023  0.6 20:37    01:00:17 nginx: worker process
     4487 20:37:01 Fri Jul 21 20:37:01 2023  0.3 20:37    01:00:17 nginx: worker process
     4488 20:37:01 Fri Jul 21 20:37:01 2023  1.8 20:37    01:00:17 nginx: worker process
     4489 20:37:01 Fri Jul 21 20:37:01 2023  0.9 20:37    01:00:17 nginx: worker process
     4490 20:37:01 Fri Jul 21 20:37:01 2023  5.6 20:37    01:00:17 nginx: worker process
     4491 20:37:01 Fri Jul 21 20:37:01 2023 10.2 20:37    01:00:17 nginx: worker process
     4492 20:37:01 Fri Jul 21 20:37:01 2023 15.9 20:37    01:00:17 nginx: worker process
     4493 20:37:01 Fri Jul 21 20:37:01 2023 19.1 20:37    01:00:17 nginx: worker process
     5968   Jun 29 Thu Jun 29 12:22:34 2023  0.0 6月29 22-09:14:44 nginx: master process /usr/sbin/nginx
    19489 21:37:18 Fri Jul 21 21:37:18 2023  0.0 21:37       00:00 grep --color=auto nginx

     

  2. ps -eo start,cmd
    月-日格式
     PID  STARTED CMD
        1   Nov 20 /usr/lib/systemd/systemd --switched-root --system --deserialize 22
        2   Nov 20 [kthreadd]
        3   Nov 20 [rcu_gp]
        4   Nov 20 [rcu_par_gp]

    时-分-秒格式

     4480 20:37:01 nginx: worker process
     4481 20:37:01 nginx: worker process
     4482 20:37:01 nginx: worker process
     4483 20:37:01 nginx: worker process
     4484 20:37:01 nginx: worker process

     

  3. ps -eo pid,start_time,cmd
    月-日格式
    37871 7月19 [kworker/u96:2-e]

    时-分格式

    41143 10:06 [kworker/33:2-ev]
    41791 19:51 [kworker/32:2-cg]
    42044 19:52 [kworker/38:0-ev]

     

常用查询参数


  1. ps -eo pid,lstart,etime,cmd | head -n 1 && ps -eo pid,lstart,etime,cmd
    [21:45:12] root@test-b5-nginx-33-102:/etc/tengine # ps -eo pid,lstart,etime,cmd | head -n 1 && ps -eo pid,lstart,etime,cmd | grep nginx
      PID                  STARTED     ELAPSED CMD
     4470 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4471 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4472 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4473 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4474 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4475 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4476 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4477 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4478 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4479 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4480 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4481 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4482 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4483 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4484 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4485 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4486 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4487 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4488 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4489 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4490 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4491 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process
     4492 Fri Jul 21 20:37:01 2023    01:08:22 nginx: worker process

     

标签:ps,01,20,21,查看,process,37,nginx,Linux
From: https://www.cnblogs.com/apink/p/17572435.html

相关文章

  • Uncaught AssertionError: Assertion failed. See https://openlayers.org/en/v6.15.1
    openlayers点击具体错误Cannotfitemptyextentprovidedas geometry.这个错误信息意味着OpenLayers在尝试使用一个空的范围作为几何图形时出现了问题。范围(extent)表示几何图形覆盖的边界框或区域,它由四个坐标值组成:最小经度、最小纬度、最大经度和最大纬度。当范围没有......
  • 实现PS端YOLO网络参数导入函数
    实现PS端YOLO网络参数导入函数目的:从SD卡读取Python生成的YOLO网络的所有参数的bin文件,并存储到DDR3内存中,为YOLO网络的推理和计算功能做准备在main.c文件中调用load_param函数,一次性导入所有层的参数前提:已经在Vivado和Vitis中创建了工程,并导出了硬件平台已经在Pyth......
  • linux cpp g++ mysqlconnector
    1.installmysqlinubuntu;2installmysqlconnector;sudoaptinstalllibmysqlclient-dev3.completecode#include<algorithm>#include<chrono>#include<cstdio>#include<cstdint>#include<cstdlib>#include<ctime>......
  • Archlinux+Windows 双系统安装教程(UEFI)2023七月
    前言之前的随笔本人提到过等有时间后写一篇关于manjaro与windows双系统安装的教程,但由于“这样那样的原因”,本人已不再使用manjaro,本人已经切换到archlinux的环境下,故本次的教程将主角换成了archlinux。你需要具备的一些素质1.能够自主地阅读官方文档.,按照本人的教程不代表你......
  • linux Vim配置Golang语言环境
    下载vim要配置Linux上的Vim,可以按照以下步骤进行操作:打开终端并运行以下命令安装Vim:sudoapt-getupdatesudoapt-getinstallvim12在主目录下创建.vimrc文件:cd~touch.vimrc12编辑.vimrc文件并添加您想要的配置选项。例如,您可以添加以下行以启用语法高亮和......
  • Linux下编译安装python3.7 附带python-dev
    1、安装开发工具包sudoyum-ygroupinstall"Developmenttools" 2、安装依赖包sudoyum-yinstallzlib-develbzip2-developenssl-develncurses-develsqlite-develreadline-develtk-develgdbm-develdb4-devellibpcap-develxz-devellibffi-devel ......
  • Linux系统命令提示符更改颜色
    Linux命令终端自定义修改PS11.了解PS1PS1是Linux终端用户的一个环境变量,用来定义命令行提示符的参数。在终端输入命令:$set|grepPS1可得到当前PS1的定义值:PS1='[\u@\h\W]\$'PS1的常用参数以及含义:\d:代表日期,格式为weekdaymonthdate,例如:"MonAug1"\H:完整的主机......
  • linux系统编程学习笔记
    IO当系统调用io与标准io都能完成相同功能时,优先使用标准io因为不同操作系统提供的系统调用不同,但标准io是之上的封装,不会随着系统的不同改变另外标准io可以合并系统调用,加速如标准io如fopen,在linux下依赖open,在windows下依赖openfile标准IO与系统IO区别一个吞吐量大(即先缓存......
  • linux删除文件、文件夹
    linux删除文件夹  1、除文件夹实例:rm-rf/var/log/httpd/access 将会删除/var/log/httpd/access目录以及其下所有文件、文件夹 2、删除文件使用实例:rm-f/var/log/httpd/access.log 将会强制删除/var/log/httpd/access.log这个文件......
  • Linux中内核线程可以被抢占吗?
    1背景 说起抢占,需要关注服务器上Linux内核中的CONFIG_PREEMPT_xxx采用的何种模式,下面是几个比较常见系统的配置方式例如REHL以及centos7使用的是CONFIG_PREEMPT_VOLUNTARY又例如SLES以及龙蜥OS使用的是CONFIG_PREEMPT_NONE 咱们这里要分析的就是在CONFIG_PREEMPT_VOLUN......