Common Flags Reference
Nmap has over 100 command-line flags. This reference organizes the most essential ones into seven categories, each with a description and a working example you can copy and modify.
Scan Control
-sSTCP SYN scan (stealth, default with root)
nmap -sS 10.0.0.1-sTTCP Connect scan (uses OS connect())
nmap -sT 10.0.0.1-sUUDP scan
nmap -sU -p 53 10.0.0.1-sVService/version detection
nmap -sV 10.0.0.1-OOS detection (fingerprinting)
nmap -O 10.0.0.1-AAggressive: enables -O, -sV, -sC, --traceroute
nmap -A 10.0.0.1-sCRun default NSE scripts
nmap -sC 10.0.0.1-snPing scan only (no ports)
nmap -sn 10.0.0.0/24-PnSkip host discovery, treat all as online
nmap -Pn 10.0.0.1Port Selection
-p <ports>Scan specific ports (comma or range)
nmap -p 22,80,443 10.0.0.1-p-Scan all 65,535 TCP ports
nmap -p- 10.0.0.1-p 1-1000Scan port range
nmap -p 1-1000 10.0.0.1--top-ports <n>Scan the N most common ports
nmap --top-ports 100 10.0.0.1-FFast scan: top 100 ports
nmap -F 10.0.0.1-rScan ports in sequential order (not random)
nmap -r -p- 10.0.0.1--port-ratio <ratio>Scan ports more common than given ratio
nmap --port-ratio 0.01 10.0.0.1Host Discovery
-PS<portlist>TCP SYN ping on specified ports
nmap -PS22,80,443 10.0.0.1-PA<portlist>TCP ACK ping on specified ports
nmap -PA80 10.0.0.1-PU<portlist>UDP ping on specified ports
nmap -PU53 10.0.0.1-PEICMP echo request ping
nmap -PE 10.0.0.1-PPICMP timestamp request ping
nmap -PP 10.0.0.1-PMICMP address mask request ping
nmap -PM 10.0.0.1-PRARP ping (local networks only)
nmap -PR 10.0.0.0/24-nNever do DNS resolution
nmap -n 10.0.0.1-RAlways do DNS resolution
nmap -R 10.0.0.1Timing & Performance
-T<0-5>Set timing template (0=paranoid, 5=insane)
nmap -T4 10.0.0.1--min-parallelism <num>Minimum probe parallelism
nmap --min-parallelism 100 10.0.0.1--max-parallelism <num>Maximum probe parallelism
nmap --max-parallelism 50 10.0.0.1--min-rtt-timeout <time>Minimum probe round trip time
nmap --min-rtt-timeout 100ms 10.0.0.1--max-rtt-timeout <time>Maximum probe round trip time
nmap --max-rtt-timeout 2s 10.0.0.1--max-retries <tries>Maximum number of port scan probe retransmissions
nmap --max-retries 3 10.0.0.1--host-timeout <time>Give up on target after this time
nmap --host-timeout 30m 10.0.0.0/24--scan-delay <time>Delay between probes to a host
nmap --scan-delay 5s 10.0.0.1Evasion & Spoofing
-fFragment packets (8 bytes after header)
nmap -f 10.0.0.1-D <decoy1,decoy2,...>Hide scan among decoys
nmap -D RND:10,ME 10.0.0.1-S <IP_Address>Spoof source address
nmap -S 192.168.1.100 10.0.0.1-e <iface>Use specified network interface
nmap -e eth0 10.0.0.1--source-port <portnum>Spoof source port number
nmap --source-port 53 10.0.0.1--data-length <num>Append random data to packet payloads
nmap --data-length 200 10.0.0.1--spoof-mac <mac>Spoof MAC address
nmap --spoof-mac 0 10.0.0.1--badsumSend packets with bogus checksums
nmap --badsum 10.0.0.1Output Formats
-oN <file>Normal output (human readable)
nmap -oN scan.txt 10.0.0.1-oX <file>XML output
nmap -oX scan.xml 10.0.0.1-oG <file>Grepable output
nmap -oG scan.gnmap 10.0.0.1-oA <basename>Output in all major formats
nmap -oA scan 10.0.0.1-vIncrease verbosity
nmap -v 10.0.0.1-vvMore verbosity
nmap -vv 10.0.0.1-dIncrease debugging level
nmap -d 10.0.0.1--reasonDisplay reason for port state
nmap --reason 10.0.0.1--openOnly show open (or possibly open) ports
nmap --open 10.0.0.1--packet-traceShow all packets sent and received
nmap --packet-trace 10.0.0.1Target Specification
-iL <inputfilename>Read targets from file
nmap -iL targets.txt-iR <num hosts>Choose random targets
nmap -iR 100--exclude <host1,...>Exclude hosts/networks
nmap --exclude 10.0.0.1 10.0.0.0/24--excludefile <exclude_file>Exclude list from file
nmap --excludefile exclude.txt 10.0.0.0/24Info
nmap --help or consult the official Nmap manual at nmap.org/book/man.html