最简单的方法是ps -ef,查看 STIME 列的启动时间。对于进程 X,使用ps -ef | grep -i X. 一种更复杂的方法(对于经过的时间是必需的)是使用该-o选项。使用它:
相当于ps -efISps -eo uid,pid,ppid,c,stime,tty,time,cmd
从手册页:
Run Code Online (Sandbox Code Playgroud)etime ELAPSED elapsed time since the process was started, in the form [[DD-]hh:]mm:ss. start STARTED time the command started. If the process was started less than 24 hours ago, the output format is "HH:MM:SS", else it is " <mm dd" (where Mmm is a three-letter month name). See also lstart, bsdstart, start_time, and stime.
因此,对于名为“X”的进程来说,一个简单的方法是:
搜索命令运行:ps -eo pid,cmd,start,etime | grep -i X
搜索可执行文件名称:ps -eo pid,comm,start,etime | grep -i X
搜索两者:ps -eo pid,comm,cmd,start,etime | grep -i X
如果您要经常使用它,您可能需要设置别名。
| 归档时间: |
|
| 查看次数: |
9325 次 |
| 最近记录: |