Check if a remote port is open with `nc -zv`
The fastest way to answer 'is the firewall blocking me?' — netcat in scan mode attempts one TCP connection and prints whether it succeeded.
01Command
$ nc -zv example.com 44302What it does
`-z` puts nc into zero-I/O mode: it opens a connection and closes it immediately without sending any payload, which is exactly what a port check needs. `-v` prints the result in plain words instead of relying on the exit code. Add `-w 3` to avoid hanging on filtered ports, and `-u` to test UDP (results are unreliable since UDP has no connection state).
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- nc(1) — arbitrary TCP and UDP connections and listens (OpenBSD netcat)Evidence: Documents -z (zero-I/O scan mode) and -v (verbose) for testing if a port is open without sending data
- OpenSSL — ArchWikiEvidence: ArchWiki network troubleshooting pages commonly recommend nc -zv for quick port reachability checks
Last verified: 2026-09-17 · Category: Network
06Related solutions
One command that prints every interface with its state and IPv4/IPv6 addresses in a short table — the modern, memorable replacement for digging through `ifconfig` or the verbose `ip addr` output.
The routing table is the first thing to check when traffic leaves the wrong interface or the gateway seems dead — and `ip route show` is the quick, modern way to read it.
On systemd-based Linux (Ubuntu, Fedora, Debian 12+), the local DNS stub cache is managed by systemd-resolved — and the command to clear it is easy to forget because it changed from systemd-resolve.