头像

MacOS 查看端口占用情况

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

发布作者:admin

4579

一、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. Centos7 安装 PHP7最新版的详细教程
  2. ThinkPHP3.2.3 RCE漏洞
  3. linux centos6/7 安装vsftpd
  4. mysql binlog日志自动清理及手动删除