sudo lsof -iTCP -sTCP:LISTEN : to list processes that list on ports

-i : show all connections
-i : show all TCP connections
-sTCP:LISTEN : show TCP connections in LISTEN state
-t : output only pid (useful as kill -9 `lsof -t ...` arg)
-n : no dans resolution
-P : no port resolution

Alternative:
netstat -an | grep 5432 : show open ports 5432
Go to index of articles.

Share on