[root@jenkins ~]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:9999 0.0.0.0:* LISTEN 10860/java
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 14706/java
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1409/sshd
tcp 0 0 0.0.0.0:8899 0.0.0.0:* LISTEN 19657/java
tcp6 0 0 :::9100 :::* LISTEN 15154/node_exporter
- 自己安装的服务器,默认没有安装netstat,运行yum install net-tools -y安装即可
查看一下进程的运行时间,使用lstart参数
[root@jenkins ~]# ps -p 14706 -o lstart
STARTED
Wed Aug 5 19:39:29 2020
进程启动时,使用的用户,使用user参数
[root@jenkins ~]# ps -p 14706 -o user
USER
xiaoxin
连接服务操作这个进程的终端,使用tty参数
[root@jenkins ~]# ps -p 14706 -o tty
TT
?
查看这个进程的命令,使用comm参数
[root@jenkins ~]# ps -p 14706 -o comm
COMMAND
java
参数etime是查看进程启动以来,经历过的时间,时间格式:DD-HH:mm:ss,如果是etimes自该矜持启动以来,经历过的时间,单位是秒。
[root@jenkins ~]# ps -p 14706 -o etime
ELAPSED
12-21:42:39
评论