sudo lsof -nP -i 

On macOS High Sierra and later, use this command:

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

or to just see just IPv4:

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

On older versions, use one of the following forms:

sudo lsof -nP -iTCP:$PORT | grep LISTEN
sudo lsof -nP -i:$PORT | grep LISTEN

标签: none

添加新评论