Use nmap against localhost only to estimate services and versions on TCP ports 22, 80, and 443.
Which command is appropriate?
nmap -sV performs service/version detection and -p restricts the scan to selected ports.
Detailed explanation
nmap -sV -p 22,80,443 127.0.0.1Correct. It performs service/version detection on the three local TCP ports.
Correct. It performs service/version detection on the three local TCP ports.
nmap -sn 127.0.0.1Incorrect. -sn performs host discovery without a port scan.
Incorrect. -sn performs host discovery without a port scan.
nmap -O -p 22,80,443 127.0.0.1Incorrect. -O performs OS detection rather than service-version detection.
Incorrect. -O performs OS detection rather than service-version detection.
nmap -sU -p 22,80,443 127.0.0.1Incorrect. -sU selects UDP scanning.
Incorrect. -sU selects UDP scanning.
Try it yourself
An example you can run in a temporary verification environment.
nmap --help 2>&1 | grep -E -- '-sV|VERSION DETECTION' | head -n 2Expected result
-sVまたはVERSION DETECTIONの説明行Key points
- -sV is service/version detection
- -p selects ports
- Limit scope to localhost
Notes
- Environment: Nmap help / scanは実行しない
- 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.