笔记:获取进程实际运行时间
[root@localhost ~]# netstat -antp Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 192.168.50.248:6666 0.0.0.0:* LISTEN 2296/scheduling tcp 0 0 0.0.0.0:6667 0.0.0.0:* LISTEN 2533/parsepacket tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 817/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2084/master tcp 0 52 192.168.50.248:22 192.168.50.4:9518 ESTABLISHED 18467/sshd: root@pt tcp 0 0 192.168.50.248:22 192.168.50.4:9833 ESTABLISHED 31086/sshd: root@pt tcp6 0 0 :::3306 :::* LISTEN 2255/mysqld tcp6 0 0 :::22 :::* LISTEN 817/sshd [root@localhost ~]# ps -p 2533 -o etime,cmd,pid ELAPSED CMD PID 1-04:31:32 parsepacket start 2533
通过ps命令的etime(elapsed time的缩写)可以获取该值