How do you determine if a port is in use? - TechRepublic
General discussion
March 7, 2012 at 05:18 AM
nhilty

How do you determine if a port is in use?

by nhilty . Updated 14 years, 3 months ago

I have run across multiple ways to check and see if a port is in use and the quickest and easist way is to run a the following netstat command. For example: if you wanted to see if port 9800 was currently in use, you would enter

netstat -an | grep 9800

Returns the following if port 9800 is already in use, in this case, an application is already listening on port 9800:
$ netstat -an | grep 9800
*.9800 *.* 0 0 49152 0 LISTEN

If the port was not in use, the following would get returned:
netstat -an | grep 9801
$

This discussion is locked

All Comments