root@ubuntu:~# lsof -i:8000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 87955 root 25u IPv6 392398042 0t0 TCP *:8000 (LISTEN)
精确查询
root@ubuntu:~# netstat -nplt |grep 8000
tcp6 0 0 :::8000 :::* LISTEN 87955/java
root@ubuntu:~# netstat -tunlp|grep 8000
tcp6 0 0 :::8000 :::* LISTEN 87955/java
查询全部
root@ubuntu:~# sudo netstat -nplt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 192.168.10.125:9093 0.0.0.0:* LISTEN 153865/docker-proxy
tcp 0 0 192.168.10.125:9000 0.0.0.0:* LISTEN 29952/docker-proxy
tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 2025/beam.smp
tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN 1332/mongod
tcp 0 0 192.168.10.125:3306 0.0.0.0:* LISTEN 100285/mysqld
tcp 0 0 192.168.10.125:26379 0.0.0.0:* LISTEN 20022/docker-proxy
tcp 0 0 192.168.10.125:26380 0.0.0.0:* LISTEN 20039/docker-proxy
tcp 0 0 192.168.10.125:6380 0.0.0.0:* LISTEN 19805/docker-proxy
tcp 0 0 192.168.10.125:6381 0.0.0.0:* LISTEN 20076/docker-proxy
tcp 0 0 192.168.10.125:26381 0.0.0.0:* LISTEN 20053/docker-proxy
tcp 0 0 192.168.10.125:6382 0.0.0.0:* LISTEN 19944/docker-proxy
模糊查询
root@ubuntu:~# netstat -ap | grep 8000
tcp 0 0 172.17.0.1:58000 172.17.0.20:8113 FIN_WAIT2 244146/docker-proxy
tcp 0 0 172.17.0.1:48000 172.17.0.20:8113 FIN_WAIT2 244146/docker-proxy
tcp 0 0 172.17.0.1:38000 172.17.0.20:8113 FIN_WAIT2 244146/docker-proxy
root@ubuntu:~# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Apr18 ? 00:32:41 /sbin/init
root 2 0 0 Apr18 ? 00:00:04 [kthreadd]
root 3 2 0 Apr18 ? 00:04:25 [ksoftirqd/0]
root 5 2 0 Apr18 ? 00:00:00 [kworker/0:0H]
root@ubuntu:~# ps -ef|grep node
root 5380 5357 0 Jun24 ? 00:02:20 node server.js
root 90715 87407 0 16:02 pts/6 00:00:00 grep --color=auto node
nobody 97745 97711 0 Jul26 ? 00:01:19 /bin/node_exporter
root 245173 242899 0 Apr19 ? 00:00:11 node server.js
root 245180 242999 0 Apr19 ? 00:00:10 node server.js
kill -9 <PID>
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://blog.csdn.net/weixin_43296313/article/details/126287411
内容来源于网络,如有侵权,请联系作者删除!