Use OpenBSD nc to test TCP port 443 on 192.0.2.20 without sending data.
Show a verbose result.
Which command is appropriate?
nc -z performs a zero-I/O port check and -v reports the result verbosely. Without -u, the test uses TCP.
Detailed explanation
nc -l 192.0.2.20 443Incorrect. -l starts local listening mode.
Incorrect. -l starts local listening mode.
nc -u -z 192.0.2.20 443Incorrect. -u selects UDP rather than TCP.
Incorrect. -u selects UDP rather than TCP.
nc -v 192.0.2.20Incorrect. The destination port is missing.
Incorrect. The destination port is missing.
nc -v -z 192.0.2.20 443Correct. It performs a verbose TCP zero-I/O check of port 443.
Correct. It performs a verbose TCP zero-I/O check of port 443.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' '-z=zero-I/O scan' '-v=verbose' 'no -u=TCP'Expected result
-z=zero-I/O scan
-v=verbose
no -u=TCPKey points
- -z is zero-I/O
- -v is verbose
- Without -u, use TCP
Notes
- Environment: OpenBSD netcatのoption対応表(外部通信なし)
- 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.