linux查看端口号

 

https://www.cnblogs.com/hindy/p/7249234.html

 

 

 ps aux|grep 应用名

netstat  -anp  |grep   端口号

 

端口号查看进程号(查看端口占用情况)

lsof -i:端口号
## 或者
netstat -ntulp |grep 端口号


根据进程号查询正在运行的程序的port(端口号)
netstat -anop | grep pid
  netstat -tulnp | grep :<端口号>

 

 

 

 

Centos7:查看某个端口被哪个进程占用

安装net-tools工具
yum install net-tools
 
netstat -lnp | grep 8031

 

 

 

 

Windows端口开启关闭

 
复制代码
netstat-a  #显示所有活动的TCP连接以及计算机监听的TCP和UDP端口。
netstat-e  #显示以太网发送和接收的字节数、数据包数等。
netstat-n  #以数字形式显示所有活动的TCP连接的地址和端口号。
netstat-o  #显示活动的TCP连接并包括每个连接的进程ID(PID)。
netstat-s  #按协议显示各种连接的统计信息,包括端口号。
netstat-an #查看所有开放的端口。
复制代码

1. 查看端口占用

在windows命令行窗口下执行:

netstat -aon|findstr "8080"

 运行结果:

TCP  127.0.0.1:80    0.0.0.0:0    LISTENING   2448

端口“8080”被PID(进程号)为2448的进程占用。
查看端口“8080”被哪个应用占用,,继续执行下面命令:

tasklist|findstr "2448"

运行结果:

notepad.exe        2016 Console         0     16,064 K

2. 关闭进程

2.1 按进程号关闭进程

taskkill /pid 2152多个时格式为:

taskkill /pid 2152 /pid 1284

 

 https://www.cnblogs.com/shenyiyangle/p/10503754.html

 

 

 

 

linux查看进程号、端口号

 https://blog.csdn.net/m0_67392661/article/details/126434511

posted @ 2019-12-06 17:55  wq9  阅读(1790)  评论(0)    收藏  举报