Test Port Connection

Introduction
There are different ways to check if a remote port is open. For TCP ports, a simple telnet [host name | ip address] [port] is enough, but for UDP ports you can't use telnet.

/dev/tcp or /dev/udp
Command: timeout 1 bash -c '>/dev/[tcp|udp]/[ip address]/[port] && echo Port is open || echo Port is closed' || echo Connection timeout

Example: timeout 1 bash -c '>/dev/udp/172.24.100.11/123 && echo Port is open || echo Port is closed' || echo Connection timeout Port is open

Possible states:
 * Port is open (and reachable)
 * Port is closed (but reachable)
 * Connection timeout (due to a firewall)