Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need a utility built into several versions of Windows (XP to Win7 specifically) that can tell me if a particular port is in use. I've found a few different ways for each OS, but I'm looking for a single command that works across all of them.

share|improve this question
    
by the way: i have seen this thread serverfault.com/questions/35218/…, but it does not answer my queestion ;-) –  dmeu May 25 '11 at 11:18
1  
There is not one tool, just a bunch of well-documented commands that have been around forever. What EXACTLY are you trying to do? –  KCotreau May 25 '11 at 12:00
    
I want to see if a port is in use or not. and it must work on all windows system mentioned –  dmeu May 25 '11 at 15:05

3 Answers 3

up vote 5 down vote accepted

Perhaps Netstat? netstat -h will give options.

share|improve this answer
    
Ok, netstat is also an option thanks a lot! Somebody who knows about windows could confirm if it is present in all the windows systems? Thanks –  dmeu May 26 '11 at 12:51
    
It's kind of a standard tool from the earlier days of UNIX, so I'd be surprised if it didn't go back to NT 3.x en.wikipedia.org/wiki/Netstat –  Bart Silverstrim May 26 '11 at 12:53
    
netstat -ab will dump a list of binaries and their ports. I'm sure there are gui versions of netstat, but I've no experience with any. –  OldTroll May 26 '11 at 13:18
    
@dmeu, netstat is available on every version of Windows since at least NT4/Win95. –  John Gardeniers May 26 '11 at 13:22
    
netstat was also there in 3.5 but prtqry is more specific –  Jim B May 26 '11 at 13:24
netstat -bona

This will link ports to processes. Very useful if you want to know what process is running on port X.

For easy reviewing I redirect the output to a file

netstat -bona > file.txt
share|improve this answer

If you use netstat -n it will tell you the current in use ports. The -n tells it not to try to resolve hostnames from IPs. You could also run it with -a to have it TRY to resolve hostnames.

share|improve this answer
    
also very correct! but i can only select one answer as correct one... :-( –  dmeu May 26 '11 at 13:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.