0
点赞
收藏
分享

微信扫一扫

不同系统中,查看端口占用命令

在不同的操作系统中,查看端口占用的命令也是有些区别的,下面介绍一下大家常用的两个系统windows与linux

在Windows中是这样用的

  • 使用命令提示符(Command Prompt):

netstat -ano | findstr "端口号"

  • 例如,要查看80端口的占用情况:

netstat -ano | findstr ":80"

  • 或者查看所有端口及进程ID详细信息:

netstat -ano

而在Linux中却是这样用

  • 使用netstat命令(可能需要安装net-tools包):

netstat -tulpn | grep 端口号

  • 查看TCP监听的80端口:

netstat -tulnp | grep ':80'

  • 使用lsof命令(可能需要安装lsof包):

lsof -i :端口号

  • 查看80端口占用情况:

lsof -i :80

  • 使用ss命令(较新的Linux发行版替代netstat):

ss -tulpn | grep 端口号

  • 查看80端口占用情况:

ss -tulnp | grep ':80'

举报

相关推荐

0 条评论