Use OpenBSD nc to perform a zero-I/O diagnostic of UDP port 53 on 192.0.2.53.
Show verbose output and stop waiting after two seconds.
Which command is appropriate?
With OpenBSD nc, -u selects UDP, -z selects zero-I/O, -v is verbose, and -w sets a timeout. A lack of UDP response alone cannot prove a port is closed.
Detailed explanation
nc -zv -w 2 192.0.2.53 53Incorrect. Without -u, the default is TCP.
Incorrect. Without -u, the default is TCP.
nc -zvu -w 2 192.0.2.53 53Correct. It selects UDP, zero-I/O, verbose output, and a two-second timeout.
Correct. It selects UDP, zero-I/O, verbose output, and a two-second timeout.
nc -lvu -w 2 192.0.2.53 53Incorrect. -l makes nc listen locally rather than probe the remote service.
Incorrect. -l makes nc listen locally rather than probe the remote service.
nc -zv -w 53 192.0.2.53 2Incorrect. The timeout and destination-port values are reversed.
Incorrect. The timeout and destination-port values are reversed.
Try it yourself
An example you can run in a temporary verification environment.
nc -h 2>&1 | sed -n '1,14p'Expected result
-u、-z、-v、-wなどのオプション概要Key points
- -u selects UDP
- -z is zero-I/O
- Interpret UDP results cautiously
Notes
- Environment: OpenBSD netcat help / 外部接続なし
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.