Mac/Linux: Show all used ports

Submitted by Peter Majmesku on Tue, 12/12/2017 - 14:09

Mac:

sudo lsof -i -n -P

Linux:

netstat -tulpen

Show if a port is opened on an endpoint

Check via Netcat (Mac and Linux only). A failed connection (432 is a port, which I have chosen randomly):

/mnt/c/Users/jepster/Dev/mobilefish.de:master$ nc -v my.salsaforum.net 432
nc: connect to my.salsaforum.net port 432 (tcp) failed: Connection refused

A successful connection (port 25 is used for SMTP, needed for mail retrieval in mailserver):

/mnt/c/Users/jepster/Dev/mobilefish.de:master$ nc -v my.salsaforum.net 25
Connection to my.salsaforum.net 25 port [tcp/smtp] succeeded!
220 my.salsaforum.net ESMTP Haraka/2.8.23 ready

 

Tags