Search This Blog

Thursday, March 14, 2013

Testing available ports on my Ubuntu machine


As the title suggests, I was setting up a software on my machine and I needed to know which ports were already used up and which were available for the new install.

I found some posts on the Internet to help me resolve this, and here is a summary of what I found.

First, I logged in as root using the command

$ sudo -i


Next I listed all processes that are listening on a port using the following command.

$ lsof -i


Now, I wanted to know all the used ports on my machine. The following command gave the answer.

$ netstat -tulpn



Finally, I wanted to list only those ports that were being used along with the processes.

$ netstat -lptu



This gave a list of ports that are currently in use on my machine. Using this list, I was able to find out which ports could be assigned to the new installation.


No comments: