I use a fairly simple WGET command to verify if the IP Address and port are open or closed for a particular server: wget -a /tmp/ports.log -t1 -T1

The issue I have is that there are a number of servers that I need to check, and each server links to other IP addresses/ports.

Currently I have several of these one liner type scripts deployed on each of the specific servers which require being run manually as and when required.

Ideally, I am looking to customize this with one script that can recursively read in a flat file of IP addresses/ports using a WGET command. The resulting report produced will identify those that are not connected (ie: "failed: Connection timed out.").

The script should ideally run from within windows rather than deployed and run on each of the server. A list of user id’s/passwords can be obtained for each server if this needs to be passed via the script.

  • 4
    On windows? You're asking on a *nix forum for a solution that can run on windows? Of course wget is cross platform, but the suggestions for scripting you are going to get here are going to be *nix central!
    – Caleb
    Apr 21, 2011 at 7:49
  • 1
    @Caleb: It's ok to ask about unix-y tools even if you're running on them other platforms. @Evan: But you should be clear about what you're using. In particular, it's not clear what unix scripting tool you expect to be available (in addition to wget): Cygwin? Any POSIX shell and utilities? Apr 21, 2011 at 10:12

2 Answers 2


The network scanning app nmap would be a much more apt tool to scan a batch of IPs to figure out if the host is up and if a particular port is open.


As suggested by Caleb, nmap should be the tool of choice in this case. With nmap you can do like this:

nmap -p 80,21-25

to learn whether one or more ports (in this example port #s 21-25, and 80) are open or closed on a particular IP address. In my machine I get the following output:

Starting Nmap 5.00 ( http://nmap.org ) at 2011-04-21 15:29 IST
Interesting ports on localhost (
25/tcp closed smtp
26/tcp closed rsftp
27/tcp closed nsw-fe
28/tcp closed unknown
29/tcp closed msg-icp
80/tcp open   http

Nmap done: 1 IP address (1 host up) scanned in 0.12 seconds

Nmap for Windows can be downloaded from here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .