1. Home
  2. Nipa Academy
  3. System Engineer Guide
  4. How to Test Port [TCP/UDP] by using nc command

How to Test Port [TCP/UDP] by using nc command

To test connectivity a TCP ports as follows:

# nc -z -v [hostname/IP address] [port number]

For example,

# nc -z -v 139.5.145.209 443
Connection to 139.5.145.209 port 443 [tcp/ssh] succeeded!
# nc -z -v 139.5.145.209 443
nc: connectx to 103.74.254.202 port 443 (tcp) failed: Connection refused

To test connectivity a UDP ports as follows:

# nc -z -v -u [hostname/IP address] [port number]

For example,

# nc -z -v -u 103.74.254.202 10000
Connection to 103.74.254.202 port 10000 [udp/ndmp] succeeded!

Was this article helpful?

Related Articles