26 Feb
Posted by: Brandon Harper in: Apache HTTPD, Apache Tomcat, Culture, FreeBSD, JBoss, Linux, MySQL, OS X, Operating Systems, PostgreSQL, Servers, Tips, Hacks, & Tricks, Windows
This is just a quick entry on how to see which software is using which ports. This comes in handy when trying to install an application server, web server, etc, and are getting errors like "port is in use".
Basically in any Unix type derivative such as Linux such (Ubuntu, RedHat, SuSe, etc.), as well as Mac OS X, all that you need to type this at the command line:
I remember there being a couple of commands in Windows which you could do this with, but it's been so long since I've used Windows on a regular basis I honestly don't remember how to do it. I do know you can use TCPView to accomplish the same thing, however.
3 Responses
Bubbagimp
26|Feb|2008 1In Vista and XP SP2 you can run "netstat -b" and it will show the process associated with the port.
In Vista the tricky part is, it requires an elevated command line window. The easiest way to do this I found is to type "cmd" in the search portion of the start menu and hit ctrl-shift-enter to elevate the process. Click continue to confirm the action. You have to do this even if your account is set to Administrator.
Have I mentioned I hate Vista?
Bubbagimp
26|Feb|2008 2Whoops, just to clarify -b shows the program that opened the port. The option -o shows the PID.
freebsd vps
26|Feb|2008 3Nice tip. I use 'netstat -anp | grep LISTEN' on Linux which usually runs faster than lsof. But it doesn't work the same on FreeBSD.
Leave a reply