'Linux/OSX: find out what network ports are in use'

RustyRazorblade Consulting RustyRazorblade Consulting
1 min read

To get a quick idea of what ports you have open on your local box, you can use nmap.

~ jhaddad$ nmap localhost Starting Nmap 5.00 ( http://nmap.org ) at 2010-01-05 11:06 PST Interesting ports on localhost (127.0.0.1): Not shown: 499 closed ports, 492 filtered ports PORT STATE SERVICE 80/tcp open http 88/tcp open kerberos-sec 548/tcp open afp 631/tcp open ipp 3306/tcp open mysql 3325/tcp open unknown 5900/tcp open vnc 9000/tcp open cslistener 10000/tcp open snet-sensor-mgmt

To get a quick idea of what ports you have open on your local box, you can use nmap.

~ jhaddad$ nmap localhost Starting Nmap 5.00 ( http://nmap.org ) at 2010-01-05 11:06 PST Interesting ports on localhost (127.0.0.1): Not shown: 499 closed ports, 492 filtered ports PORT STATE SERVICE 80/tcp open http 88/tcp open kerberos-sec 548/tcp open afp 631/tcp open ipp 3306/tcp open mysql 3325/tcp open unknown 5900/tcp open vnc 9000/tcp open cslistener 10000/tcp open snet-sensor-mgmt

For more detailed information, try netstat:

netstat -an

You’ll get a breakdown of every socket open on your machine - useful for figuring out who’s connected and from where.

The OSX version of netstat lacks a few options - such as the useful ‘-p’ option to display the process id (PID) - which can be useful combined with kill to get rid of unwanted connections - for instance,an SSH tunnel accidentally left open.

RustyRazorblade Consulting

RustyRazorblade Consulting

Apache Cassandra Consultant and Distributed Systems Expert

Related Posts

Need Expert Help with Apache Cassandra?

Get professional consulting for your distributed systems challenges. Performance optimization, architecture design, and troubleshooting.