Q. How do I find out which ports are opened on my own server? How do I run port scanning using nc command?
A. It may be useful to know which ports are open and running services on a target machine. You can use nmap command for port scanning.
How do I use nc to scan Linux / UNIX / Windows server port scanning?
If nmap is not installed try nc / netcat command. The -z flag can be used to tell nc to report open ports, rather than initiate a connection.
Run nc command with -z flag. You need to specify host name / ip along with the port range to limit and speedup operation.
$ nc -z vip-1.vsnl.nixcraft.in 1-1023
Output:
Connection to localhost 25 port [tcp/smtp] succeeded! Connection to vip-1.vsnl.nixcraft.in 25 port [tcp/smtp] succeeded! Connection to vip-1.vsnl.nixcraft.in 80 port [tcp/http] succeeded! Connection to vip-1.vsnl.nixcraft.in 143 port [tcp/imap] succeeded! Connection to vip-1.vsnl.nixcraft.in 199 port [tcp/smux] succeeded! Connection to vip-1.vsnl.nixcraft.in 783 port [tcp/*] succeeded! Connection to vip-1.vsnl.nixcraft.in 904 port [tcp/vmware-authd] succeeded! Connection to vip-1.vsnl.nixcraft.in 993 port [tcp/imaps] succeeded!
See also
- Linux: Scanning network for open ports
- netcat / nc and nmap command man page
Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!
- Email FAQ to a friend
- Printable version
- Rss Feed
- Last Updated: 8-12-07

{ 0 comments… add one now }