Use nmap to inspect TCP port states on the local host with a normal TCP connect scan.
Do not scan an external host.
Which command is appropriate?
nmap -sT uses the operating system's connect call for a TCP connect scan and can reveal locally exposed ports.
Detailed explanation
nmap -sU 127.0.0.1Incorrect. -sU performs a UDP scan.
Incorrect. -sU performs a UDP scan.
nmap -sT 127.0.0.1Correct. It runs a TCP connect scan against localhost.
Correct. It runs a TCP connect scan against localhost.
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 127.0.0.1Incorrect. -O requests OS detection rather than selecting the TCP scan method.
Incorrect. -O requests OS detection rather than selecting the TCP scan method.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' '-sT=TCP connect scan' '-sU=UDP scan' '-sn=host discovery only' '-O=OS detection'Expected result
-sT=TCP connect scan
-sU=UDP scan
-sn=host discovery only
-O=OS detectionKey points
- -sT is TCP connect
- Limit to 127.0.0.1
- -sn performs no port scan
Notes
- Environment: Nmap option対応表(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.