User Tools

Site Tools


How to get port information in Mac OS X

There is the “lsof” terminal command. This has a size field (7th field by default). This has a plethora of switches. Can probably tell you all you need to know about data connections.

sudo lsof -i : this will give you a complete list of all open network connections. Does not appear to give you the amount of data written or read from each socket though.

When searching for well-known ports, such as 8080 which is listed as http-alt due to its mapping in /etc/services, it might be easier to use sudo lsof -i -P to suppress conversion of port numbers to port names. Alternatively, explicitly specify the port one's looking for, like sudo lsof -i tcp:8080. When just trying to figure out what services are actually listening, use sudo lsof -i -P | grep LISTEN.

so in the case of serviio:

sudo lsof -i -P | grep LISTEN
sudo lsof -i udp:1900
sudo lsof -i tcp:8895

are the one you maybe asked to run.

All commands are case sensitive so make sure you copy them exactly as they are written
portinfo_mac.txt · Last modified: 2013/01/21 18:27 by slaute