Try TCP port 443 on 192.0.2.20.
Use OpenBSD netcat to check the port without starting a data session.
Which command is appropriate?
OpenBSD nc -z performs a zero-I/O port check and -v gives verbose results. The host and port are specified at the end.
Detailed explanation
nc -zv 192.0.2.20 443Correct. It performs a verbose zero-I/O TCP check of port 443.
Correct. It performs a verbose zero-I/O TCP check of port 443.
nc -l 192.0.2.20 443Incorrect. -l makes netcat listen locally.
Incorrect. -l makes netcat listen locally.
nc -u 192.0.2.20 443Incorrect. -u selects UDP rather than the requested TCP check.
Incorrect. -u selects UDP rather than the requested TCP check.
nc -w 443 192.0.2.20Incorrect. The timeout and destination port arguments are incomplete or reversed.
Incorrect. The timeout and destination port arguments are incomplete or reversed.
Try it yourself
An example you can run in a temporary verification environment.
nc -h 2>&1 | sed -n '1,12p'Expected result
-z、-v、-l、-uなどのオプション概要Key points
- -z is zero-I/O
- -v is verbose
- Default transport is TCP
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.