Mac netstat 查看端口报错 netstat: option requires an argument -- p 解决

netstat -anvp |grep 10001

查询端口的时候报错提示

意思是缺少协议。

解决方案在Mac上正确使用的方法是:即-f需要加上地址族,-p需要加上协议TCP或者UDP等

   a)如果需要查询inet,netstat -anvf inet

   b)如果需要查询TCP, netstat -anvp tcp

   b)如果需要查询UDP,netstat -anvp udp

调整如下:

netstat -anvp tcp |grep 10001



原文:https://blog.csdn.net/JoshuaXin/article/details/84300934 

原文地址:https://www.cnblogs.com/exmyth/p/13846374.html