Nmap cheat sheet
Searchable Nmap command reference: host discovery, scan types, service/OS detection, NSE scripts and timing, with every flag explained.
Runs in your browser ยท nothing is sentNew
21 commands
Host discovery
nmap -sn <target>Ping scan: find which hosts are up on a network without scanning any ports.
nmap -sn <target>Ping scan: find which hosts are up on a network without scanning any ports.Example
nmap -sn 192.168.1.0/24
Options
-sn | Disable port scanning; only perform host discovery (the "n" is for "no port scan"). |
|---|
nmap -Pn <target>Skip host discovery entirely and treat every target as online, then scan its ports directly.
nmap -Pn <target>Skip host discovery entirely and treat every target as online, then scan its ports directly.Useful when a target blocks the ping probes Nmap uses for discovery (common behind a firewall), which would otherwise make Nmap report the host as down and skip it.
Options
-Pn | Treat all hosts as online, skip the discovery/ping phase. |
|---|
nmap -sL <target>List scan: show the targets that a given specification resolves to, without sending any packets to them.
nmap -sL <target>List scan: show the targets that a given specification resolves to, without sending any packets to them.A safe way to check exactly which IPs a CIDR range or hostname list expands to before actually scanning.
nmap <target>Target specification accepts single IPs, hostnames, CIDR ranges, octet ranges, or a file of targets.
nmap <target>Target specification accepts single IPs, hostnames, CIDR ranges, octet ranges, or a file of targets.Example
nmap 192.168.1.1 192.168.1.0/24 192.168.1.1-50 scanme.nmap.org
Options
-iL <file> | Read target list from a file, one target per line. |
|---|---|
--exclude <target1,target2,...> | Exclude specific hosts from an otherwise broader scan. |
--excludefile <file> | Exclude hosts listed in a file. |
Scan types
nmap -sS <target>TCP SYN scan (the default scan when run with sufficient privileges): sends a SYN packet and reads the response without completing the TCP handshake.
nmap -sS <target>TCP SYN scan (the default scan when run with sufficient privileges): sends a SYN packet and reads the response without completing the TCP handshake.Faster and less intrusive than a full connect scan since the target application typically never sees a completed connection. Requires raw-packet privileges (root/administrator).
nmap -sT <target>TCP connect scan: completes the full TCP three-way handshake using the OS's normal connect() call.
nmap -sT <target>TCP connect scan: completes the full TCP three-way handshake using the OS's normal connect() call.Used automatically when raw-packet privileges are not available (no root/administrator), or IPv6 targets are specified. Slower and more easily logged by the target than -sS.
nmap -sU <target>UDP scan: probes UDP ports instead of TCP.
nmap -sU <target>UDP scan: probes UDP ports instead of TCP.Significantly slower than a TCP scan because UDP has no handshake to confirm a response, and many systems rate-limit the ICMP "port unreachable" replies Nmap relies on to detect closed ports.
nmap -sF <target>
nmap -sN <target>
nmap -sX <target>FIN, NULL and Xmas scans send unusual TCP flag combinations (FIN only, no flags, or FIN+PSH+URG) that some older or misconfigured firewalls and systems do not log or block, unlike a normal SYN scan.
nmap -sF <target>
nmap -sN <target>
nmap -sX <target>FIN, NULL and Xmas scans send unusual TCP flag combinations (FIN only, no flags, or FIN+PSH+URG) that some older or misconfigured firewalls and systems do not log or block, unlike a normal SYN scan.Only reliable against systems with an RFC 793-compliant TCP stack (mostly older or embedded systems); modern stacks like Windows generally respond the same way to all ports and make these scans unreliable.
nmap -sY <target>
nmap -sZ <target>-sY is an SCTP INIT scan (the SCTP equivalent of a TCP SYN scan); -sZ is an SCTP COOKIE-ECHO scan, a stealthier variant that many firewalls do not filter.
nmap -sY <target>
nmap -sZ <target>-sY is an SCTP INIT scan (the SCTP equivalent of a TCP SYN scan); -sZ is an SCTP COOKIE-ECHO scan, a stealthier variant that many firewalls do not filter.SCTP is mainly used in telecom (SS7/SIGTRAN) networks, so these are specialist scan types.
nmap -sO <target>IP protocol scan: determine which IP protocols (TCP, UDP, ICMP, GRE, and so on) a host supports, rather than scanning individual ports.
nmap -sO <target>IP protocol scan: determine which IP protocols (TCP, UDP, ICMP, GRE, and so on) a host supports, rather than scanning individual ports.Useful for discovering protocols other than TCP/UDP that a host or firewall passes, for example whether GRE or ESP (used by some VPNs) is allowed through.
Port specification
nmap -p <ports> <target>Scan only specific ports instead of the default top 1000.
nmap -p <ports> <target>Scan only specific ports instead of the default top 1000.Example
nmap -p 22,80,443 <target> nmap -p 1-1024 <target> nmap -p- <target>
Options
-p <n1>,<n2>,... | Comma-separated list of specific ports. |
|---|---|
-p <n1>-<n2> | A port range. |
-p- | Scan all 65535 ports. |
-p U:<ports>,T:<ports> | Specify different port lists for UDP (U:) and TCP (T:) in a combined -sU -sT scan. |
-F | Scan only the ports registered in the nmap-services file as "fast" (a smaller subset than the default top 1000). |
--top-ports <n> | Scan only the n most common ports according to Nmap's internal frequency data. |
nmap -F <target>Fast mode: scan fewer ports than the default (the ports in nmap-services flagged as common), trading completeness for speed.
nmap -F <target>Fast mode: scan fewer ports than the default (the ports in nmap-services flagged as common), trading completeness for speed.Good for a quick first pass across many hosts; follow up with a full -p- scan on hosts of particular interest.
Service, version & OS detection
nmap -sV <target>Probe open ports to determine the actual service and version running, instead of just guessing from the port number.
nmap -sV <target>Probe open ports to determine the actual service and version running, instead of just guessing from the port number.Nmap sends protocol-specific probes and matches the responses against its service-probes database; this is how it tells OpenSSH 9.x apart from an unrelated service that happens to also listen on port 22.
Options
--version-intensity <0-9> | How many probes to try. Higher finds more but takes longer; default is 7. |
|---|---|
--version-light | Shortcut for a low intensity (faster, less thorough). |
--version-all | Try every available probe (shortcut for intensity 9). |
nmap -O <target>Attempt to identify the target's operating system based on subtle differences in how its TCP/IP stack responds to a series of probes.
nmap -O <target>Attempt to identify the target's operating system based on subtle differences in how its TCP/IP stack responds to a series of probes.Needs at least one open and one closed TCP port on the target to work reliably, and requires raw-packet privileges.
Options
--osscan-guess | Be more aggressive about guessing the OS when there is no exact match, at the cost of more false positives. |
|---|
nmap -A <target>Shortcut that enables OS detection (-O), version detection (-sV), default script scanning (-sC) and traceroute, all in one flag.
nmap -A <target>Shortcut that enables OS detection (-O), version detection (-sV), default script scanning (-sC) and traceroute, all in one flag.Convenient for a thorough first look at a host, but noisier and slower than a targeted scan; the official docs note it should be used thoughtfully rather than as a default for every scan.
NSE scripts
nmap -sC <target>Run the default set of Nmap Scripting Engine (NSE) scripts, a curated, generally safe and useful set tagged "default".
nmap -sC <target>Run the default set of Nmap Scripting Engine (NSE) scripts, a curated, generally safe and useful set tagged "default".Included automatically by -A; run it on its own to get script output without the extra time cost of OS detection and traceroute.
nmap --script <name-or-category> <target>Run specific NSE scripts by name, category, or a comma-separated combination, instead of the default set.
nmap --script <name-or-category> <target>Run specific NSE scripts by name, category, or a comma-separated combination, instead of the default set.Example
nmap --script http-title,http-headers <target> nmap --script vuln <target>
Options
--script <name> | One script by filename (without .nse), for example http-title. |
|---|---|
--script <category> | A whole category, for example vuln, auth, discovery, safe. |
--script-args <key=value,...> | Pass arguments to a script, for example a custom wordlist or credentials for a brute-force script. |
--script-help <name> | Show a script's description and arguments without running it. |
Timing & performance
nmap -T<0-5> <target>Timing templates trade scan speed against stealth and reliability, from 0 (slowest, most evasive) to 5 (fastest, most aggressive).
nmap -T<0-5> <target>Timing templates trade scan speed against stealth and reliability, from 0 (slowest, most evasive) to 5 (fastest, most aggressive).Options
-T0 | Paranoid: extremely slow, intended to evade intrusion detection systems. |
|---|---|
-T1 | Sneaky: slow, also IDS-evasion focused. |
-T2 | Polite: slows down to use less bandwidth and target resources. |
-T3 | Normal: the default, no particular adjustment. |
-T4 | Aggressive: assumes a fast, reliable network; recommended for scanning hosts you control. |
-T5 | Insane: fastest, sacrifices accuracy for speed; may miss results on slower networks. |
nmap --min-rate <n> <target>
nmap --max-rate <n> <target>Directly control how many packets per second Nmap sends, instead of using a timing template.
nmap --min-rate <n> <target>
nmap --max-rate <n> <target>Directly control how many packets per second Nmap sends, instead of using a timing template.Options
--min-rate <n> | Never send slower than this many packets per second. |
|---|---|
--max-rate <n> | Never send faster than this many packets per second, useful to avoid overwhelming a sensitive target or link. |
Output
nmap -oN <file> <target>
nmap -oX <file> <target>
nmap -oG <file> <target>
nmap -oA <basename> <target>Save scan results to a file in a specific format.
nmap -oN <file> <target>
nmap -oX <file> <target>
nmap -oG <file> <target>
nmap -oA <basename> <target>Save scan results to a file in a specific format.Options
-oN <file> | Normal output, the same text shown on screen. |
|---|---|
-oX <file> | XML output, suitable for parsing by other tools (including Nmap's own diff/compare tooling). |
-oG <file> | Grepable output, one line per host, easy to parse with grep/awk. |
-oA <basename> | Save in all three formats at once, using <basename>.nmap, .xml and .gnmap. |
nmap -v <target>
nmap -vv <target>
nmap -d <target>Increase output detail. -v (repeatable) increases general verbosity; -d (repeatable) adds low-level debugging information.
nmap -v <target>
nmap -vv <target>
nmap -d <target>Increase output detail. -v (repeatable) increases general verbosity; -d (repeatable) adds low-level debugging information.-v shows discovered open ports as the scan runs instead of only at the end; -d is mainly useful when reporting a bug or understanding exactly what Nmap is doing.
The descriptions in this reference are currently in English.
About this tool
Search or filter by group and copy a command with one click. Open a command to see what it does, an example and every flag it takes, plus a warning for anything that can be disruptive or that you should only run on systems you are authorized to test.
๐ Your input stays in your browser and is never sent anywhere.
Frequently asked questions
Why is a UDP scan so much slower than a TCP scan?
UDP has no handshake to confirm a response, so Nmap relies on ICMP "port unreachable" replies to detect closed ports, which many systems rate-limit. Scope -sU to specific ports with -p where possible.
What to do next
Found a problem or have a suggestion? Tell us