lsof -n -i4TCP:$PORT | grep LISTEN
lsof -n -iTCP:$PORT | grep LISTEN
lsof -n -i:$PORT | grep LISTEN

其中$PORT替换为指定的端口号,或者是用英文逗号连接的一组端口号。

from