How to check listening ports on MacOS

On macOS Big Sur and later, use this command:

sudo lsof -i -P | grep LISTEN

or to just see just IPv4:

sudo lsof -nP -i4TCP:$PORT | grep LISTEN

posted on 2021-03-18 08:28  刘应杰  阅读(76)  评论(0编辑  收藏  举报

导航