mac 终端查看端口命令

查看 端口所在线程 lsof -i:81

COMMAND  PID     USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java    1867 pengxuan  189u  IPv6 0x3a47bb02362d2d59      0t0  TCP *:hosts2-ns (LISTEN)
java    1867 pengxuan  196u  IPv6 0x3a47bb02362d14d9      0t0  TCP localhost:hosts2-ns->localhost:58358 (CLOSE_WAIT)

杀死端口
pengxuandeMacBook-Air:~ pengxuan$  kill 1867

原文地址:https://www.cnblogs.com/pxuan/p/13962745.html