Wednesday, September 3, 2008

How to determine which applications are listening on which ports

If you want to find out which ports your applications are listening upon you cand easily do so by using two different commands. The following assumes you are in a Windows environment. If you find out the commands for other platforms I would appreciate if you included them as a comment.

netstat -ano ---------> This will give you the list of all ports that are being used by all your processes and will also give you the PID for that process along with some other information
tasklist /SVC ---------> This will give you a list with the names of the processes your computer is running along with their corresponding PID

The command for linux is:
sudo lsof -i [TCP]:[8080]
(don't forget to leave the brakets out and put your own parameters)
As you can see this will give you a list of all processes that are listening on port 8080 through the TCP protocol.