端口占用
# 本机正在监听的端口,如需寻找特定端口,可加 | grep <port> 过滤
lsof -i -n -P | grep LISTEN
netstat -tuln
ss -tuln
# 查看所有连接
netstat -an
# 扩展:Windows
# 先查后杀
netstat -ano | findstr :端口
Stop-Process -Id 进程号 -Force
# 一键查杀
Stop-Process -Id (Get-NetTCPConnection -LocalPort 端口).OwningProcess -Force
上次更新: 2026/07/01, 13:55:06