Nmap Cheat Sheet 2026: Complete Command Reference

A printable, copy-paste-ready reference for every Nmap flag you'll actually use in 2026. Click any command to copy it once the interactive version loads, or use your browser's print to PDF.

Basic Scans

nmap target.com

Default scan: TCP SYN against the 1,000 most common ports (requires root) or TCP connect otherwise.

nmap -sS target.com

TCP SYN (half-open) scan — fast and stealthier; never completes the 3-way handshake. Requires root.

nmap -sT target.com

Full TCP connect() scan — completes the handshake. Slower and more visible, but works without root.

nmap -sU target.com

UDP scan — much slower than TCP; useful for finding DNS, SNMP, NTP, and other UDP services.

nmap -sn 192.168.1.0/24

Ping sweep — discover live hosts in a subnet without scanning ports.

nmap -Pn target.com

Skip host discovery — treat all hosts as online (use when ICMP is blocked).

Port Specification

nmap -p 80 target.com

Scan a single port (here, port 80).

nmap -p 1-1000 target.com

Scan a port range (here, ports 1 through 1000).

nmap -p- target.com

Scan all 65,535 TCP ports — the most thorough TCP scan.

nmap --top-ports 100 target.com

Scan the 100 most commonly open ports as ranked by Nmap's frequency database.

nmap -F target.com

Fast scan — only the 100 most common ports (equivalent to --top-ports 100 with quicker timing).

Service & Version Detection

nmap -sV target.com

Probe open ports to identify the service name and version (e.g., Apache 2.4.58, OpenSSH 9.6).

nmap -sV --version-intensity 5 target.com

Set probe intensity 0-9 — higher means more probes and better accuracy at the cost of speed.

nmap -A target.com

Aggressive scan: enables OS detection (-O), version detection (-sV), default scripts (-sC), and traceroute.

nmap -O target.com

OS detection via TCP/IP fingerprinting. Requires root and at least one open and one closed port.

NSE Scripts

nmap --script=default target.com

Run the default script category (safe, useful info-gathering scripts) — same as -sC.

nmap --script=vuln target.com

Run all vulnerability-detection scripts against the target.

nmap --script=http-enum target.com

Enumerate common web app paths and admin interfaces on HTTP services.

nmap --script=smb-os-discovery target.com

Identify the OS, computer name, NetBIOS name, and domain over SMB.

sudo nmap --script-updatedb

Refresh the local NSE script database after installing or updating scripts.

nmap --script-help=http-enum

Show usage, arguments, and examples for any specific NSE script.

Output Formats

nmap -oN scan.txt target.com

Save normal human-readable output to a file.

nmap -oX scan.xml target.com

Save XML output — best for parsing into other tools (Metasploit, Faraday, custom scripts).

nmap -oG scan.gnmap target.com

Save grepable output — easy to slice with grep/awk/cut for one-liners.

nmap -oA scan target.com

Save in all three formats at once (.nmap, .xml, .gnmap with the same base filename).

nmap -vv target.com

Increase verbosity (-v once, -vv twice) — see open ports as soon as they are discovered.

Timing & Performance

nmap -T0 target.com

Paranoid timing — extremely slow, used to evade IDS detection.

nmap -T3 target.com

Normal timing (default) — balanced speed and reliability.

nmap -T5 target.com

Insane timing — fastest possible; may miss results on slow networks.

nmap --min-rate 1000 target.com

Send at least 1,000 packets per second regardless of timing template.

nmap --max-retries 1 target.com

Limit retransmissions per probe — speeds up scans on reliable networks.

Firewall Evasion

nmap -f target.com

Fragment packets into 8-byte fragments to evade simple packet filters.

nmap -D RND:10 target.com

Use 10 random decoy source IPs alongside your real IP to obscure the scan origin.

nmap --source-port 53 target.com

Spoof the source port (here, DNS/53) — bypasses some egress filters that whitelist DNS.

nmap --data-length 25 target.com

Append 25 random bytes of payload to each probe to confuse signature-based detection.

nmap -S 10.0.0.5 target.com

Spoof a source IP address (requires raw sockets and a working route back to the spoofed IP).

Useful Combinations

nmap -sV -p 80,443,8080,8443 --script=http-enum,http-title target.com

Quick web audit — version-detect web ports and enumerate paths/titles in one shot.

sudo nmap -sS -sU -p T:1-1000,U:53,123,161 target.com

Full TCP + selected UDP scan — covers the most actionable services in one run.

sudo nmap -sS -T2 -f --data-length 25 -D RND:5 target.com

Stealth scan — slow timing, fragmented packets, padding, and 5 decoys to avoid IDS triggers.

nmap -sV --script=vuln -oA vulnscan target.com

Vulnerability scan — version-detect plus all vuln NSE scripts; saves output in all formats.

nmap -sn -PE -PS22,80,443 192.168.1.0/24

Subnet discovery — ICMP echo plus TCP SYN pings on common ports to find live hosts even when ICMP is blocked.

FAQ

What is the most common Nmap scan?

The most common scan is the default TCP SYN scan: sudo nmap -sS target.com. It probes the 1,000 most-used TCP ports without completing the three-way handshake, which makes it fast and slightly less noisy than a full TCP connect scan.

Is Nmap legal to use?

Nmap itself is legal to install and use. Scanning networks or systems you do not own and do not have written permission to test is illegal in most jurisdictions and may violate the U.S. Computer Fraud and Abuse Act, the U.K. Computer Misuse Act, and similar laws elsewhere. Always get authorization in writing before scanning.

What does nmap -sS do?

nmap -sS performs a TCP SYN (half-open) scan: Nmap sends a SYN packet, waits for the SYN/ACK response indicating an open port, then sends a RST instead of completing the handshake. It is faster than -sT and never establishes a full connection, so it leaves fewer logs.

Learn More About Nmap

Related Cheat Sheets

Coming soon: Metasploit Cheat Sheet, Wireshark Cheat Sheet, Burp Suite Cheat Sheet.