using “netcat” as a port scanner on linux

There are certain time when you need to do a port scan on a remote host in a Linux shell. There are many scripts flying all over the internet giving you this ability; but wait! There’s a native way to do this.

The “netcat” command [perhaps you’ll need to install it using yum or whatever installation method you prefer] can do the job really nice!
nc <host-name-or-ip-address> -z -w 1 <start-port>-<end-port>

example:
nc -z -w 1 192.168.1.1 1-65535
this will scan for ports from 1 to 65536 on 192.168.1.1 and will wait 1 second before throwing a timeout for every port being checked.

Nice trick, wasn’t it?

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="">