Nmap Cheatsheet
Nmap command cheatsheet covering port scanning, host discovery, service detection, OS detection, NSE scripts, firewall evasion, and output options organized by category
77 commands
nmap <host>Scan a single host
nmap 192.168.1.1nmap <host1> <host2>Scan multiple hosts
nmap 192.168.1.1 192.168.1.2nmap <range>Scan an IP range
nmap 192.168.1.1-254nmap <CIDR>Scan a subnet
nmap 192.168.1.0/24nmap -iL <file>Read targets from file
nmap -iL targets.txtnmap --exclude <host>Exclude a host
nmap 192.168.1.0/24 --exclude 192.168.1.1nmap --excludefile <file>Exclude from file
nmap 192.168.1.0/24 --excludefile exclude.txtnmap -iR <num>Scan N random hosts
nmap -iR 10nmap -snPing scan, no port scan
nmap -sn 192.168.1.0/24nmap -PnSkip host discovery
nmap -Pn 192.168.1.1nmap -PS<ports>TCP SYN discovery
nmap -PS22,80,443 192.168.1.1nmap -PA<ports>TCP ACK discovery
nmap -PA80,443 192.168.1.1nmap -PU<port>UDP discovery
nmap -PU53 192.168.1.1nmap -PRARP scan (local network)
nmap -PR 192.168.1.0/24nmap -PEICMP echo discovery
nmap -PE 192.168.1.0/24nmap -nNo reverse DNS resolution
nmap -n 192.168.1.1nmap --traceroutePerform traceroute
nmap --traceroute 192.168.1.1nmap -sSTCP SYN scan (stealth)
nmap -sS 192.168.1.1nmap -sTTCP connect scan
nmap -sT 192.168.1.1nmap -sUUDP scan
nmap -sU 192.168.1.1nmap -sATCP ACK scan (firewall detection)
nmap -sA 192.168.1.1nmap -sNTCP NULL scan
nmap -sN 192.168.1.1nmap -sFTCP FIN scan
nmap -sF 192.168.1.1nmap -sXTCP Xmas scan
nmap -sX 192.168.1.1nmap -sWTCP window scan
nmap -sW 192.168.1.1nmap -sOIP protocol scan
nmap -sO 192.168.1.1nmap -p <ports>Scan specific ports
nmap -p 22,80,443 192.168.1.1nmap -p <range>Scan port range
nmap -p 1-1024 192.168.1.1nmap -p-Scan all 65535 ports
nmap -p- 192.168.1.1nmap --top-ports <n>Scan top N ports
nmap --top-ports 100 192.168.1.1nmap -FFast scan (top 100)
nmap -F 192.168.1.1nmap -sU -p <ports>Scan specific UDP ports
nmap -sU -p 53,161,500 192.168.1.1nmap -sS -sU -p T:,U:Combined TCP and UDP scan
nmap -sS -sU -p T:80,443,U:53,161 192.168.1.1nmap -p <service-name>Specify ports by service name
nmap -p http,https 192.168.1.1nmap -sVService version detection
nmap -sV 192.168.1.1nmap -OOS detection
nmap -O 192.168.1.1nmap -AAggressive scan (OS, version, scripts, traceroute)
nmap -A 192.168.1.1nmap -sV --version-intensity <n>Set version detection intensity
nmap -sV --version-intensity 5 192.168.1.1nmap -sV --version-lightLight version detection
nmap -sV --version-light 192.168.1.1nmap -sV --version-allTry all probes for version detection
nmap -sV --version-all 192.168.1.1nmap -O --osscan-guessAggressive OS guessing
nmap -O --osscan-guess 192.168.1.1nmap -O --osscan-limitLimit OS detection to promising targets
nmap -O --osscan-limit 192.168.1.1nmap --script=defaultRun default scripts
nmap --script=default 192.168.1.1nmap --script=vulnRun vulnerability scripts
nmap --script=vuln 192.168.1.1nmap --script=safeRun safe scripts
nmap --script=safe 192.168.1.1nmap --script=authRun authentication scripts
nmap --script=auth 192.168.1.1nmap --script=http-enumHTTP directory enumeration
nmap --script=http-enum 192.168.1.1nmap --script=ssl-certGet SSL certificate info
nmap --script=ssl-cert -p 443 192.168.1.1nmap --script=ssl-enum-ciphersEnumerate SSL ciphers
nmap --script=ssl-enum-ciphers -p 443 192.168.1.1nmap --script=smb-vuln*Check SMB vulnerabilities
nmap --script=smb-vuln* -p 445 192.168.1.1nmap --script=dns-bruteDNS brute force
nmap --script=dns-brute example.comnmap --script=bannerBanner grabbing
nmap --script=banner -p 21,22,25,80 192.168.1.1nmap -T0Paranoid timing (IDS evasion)
nmap -T0 192.168.1.1nmap -T1Sneaky timing
nmap -T1 192.168.1.1nmap -T2Polite timing (less bandwidth)
nmap -T2 192.168.1.1nmap -T3Normal timing (default)
nmap -T3 192.168.1.1nmap -T4Aggressive timing
nmap -T4 192.168.1.1nmap -T5Insane timing (may miss ports)
nmap -T5 192.168.1.1nmap --min-rate <n>Set minimum packet rate
nmap --min-rate 1000 192.168.1.1nmap --max-retries <n>Limit max retries
nmap --max-retries 2 192.168.1.1nmap -fFragment packets
nmap -f 192.168.1.1nmap --mtu <size>Specify MTU size
nmap --mtu 24 192.168.1.1nmap -D RND:<n>Decoy scan
nmap -D RND:5 192.168.1.1nmap -S <ip>Spoof source IP
nmap -S 192.168.1.100 192.168.1.1nmap -g <port>Specify source port
nmap -g 53 192.168.1.1nmap --data-length <n>Append random data to packets
nmap --data-length 25 192.168.1.1nmap --randomize-hostsRandomize target host order
nmap --randomize-hosts 192.168.1.0/24nmap --spoof-mac <mac>Spoof MAC address
nmap --spoof-mac 0 192.168.1.1nmap -oN <file>Save normal output
nmap -oN scan.txt 192.168.1.1nmap -oX <file>Save XML output
nmap -oX scan.xml 192.168.1.1nmap -oG <file>Save grepable output
nmap -oG scan.gnmap 192.168.1.1nmap -oA <basename>Save in all formats
nmap -oA scan 192.168.1.1nmap -vVerbose output
nmap -v 192.168.1.1nmap -vvVery verbose output
nmap -vv 192.168.1.1nmap -dDebug output
nmap -d 192.168.1.1nmap --reasonShow port state reason
nmap --reason 192.168.1.1nmap --packet-traceShow all packets sent/received
nmap --packet-trace 192.168.1.1