头像

MacOS 查看端口占用情况

发布时间:2022-04-15 15:32:05

发布作者:admin

2417

一、netstat命令

1.netstat -nat | grep <端口号>
例如命令 `netstat -nat | grep 3306`
2. netstat -nat |grep LISTEN

二、lsof命令

lsof -n -P -i TCP -s TCP:LISTEN

-n 表示主机以ip地址显示

-P 表示端口以数字形式显示,默认为端口名称

-i 意义较多,具体 man lsof, 主要是用来过滤lsof的输出结果

-s 和 -i 配合使用,用于过滤输出


相关文章:
  1. apache和nodejs共用80端口
  2. shell gzexe shc解密教程与工具共享 shc国内首发
  3. 申请免费通配符证书(Let's Encrypt)并绑定IIS
  4. AMD黑苹果Docker环境搭建