Nmap Command Cheat Sheet: Discovery, Stealth & NSE

Copy-ready Nmap CLI commands for host discovery, SYN/TCP/UDP port scanning, service fingerprinting, NSE vulnerability scripts, and output formats.

Interactive Target Variable Replacer

Change the target IP or host below and every command block on this page updates to match.

Command Reference

1. Ping Sweep / Host Discovery Only

Discover live hosts on a subnet without port scanning them.

nmap -sn 192.0.2.10/24 -oG live-hosts.gnmap

2. Fast Top-1000 TCP SYN Scan

Default half-open stealth scan with service version detection and default safe NSE scripts.

sudo nmap -sS -sC -sV -T4 192.0.2.10 -oA scan-quick

3. Full 65,535 TCP Port Sweep

Scan every TCP port with a minimum packet rate and save all output formats (.nmap, .xml, .gnmap).

sudo nmap -sS -p- --min-rate 1500 -T4 192.0.2.10 -oA scan-alltcp

4. Targeted Service & OS Detection on Known Ports

Run deep version probing and OS fingerprinting only against open ports discovered earlier.

sudo nmap -sV -sC -O -p 22,80,443,445,3389 192.0.2.10 -oA scan-services

5. Top 100 UDP Ports Scan

Check common UDP services (DNS 53, SNMP 161, NTP 123, IKE 500).

sudo nmap -sU --top-ports 100 -sV 192.0.2.10 -oA scan-udp

6. NSE Vulnerability Category Scan

Run Nmap Scripting Engine checks in the vuln and safe categories.

nmap --script "vuln and safe" -sV -p 80,443,445 192.0.2.10

7. TLS Cipher & Certificate Inspection

Enumerate supported TLS versions, cipher suites, and X.509 certificate details.

nmap --script ssl-enum-ciphers,ssl-cert -p 443 192.0.2.10

8. SMB Signing & Share Enumeration

Audit Windows/Samba hosts for SMBv1 and disabled message signing.

nmap --script smb-security-mode,smb2-security-mode,smb-enum-shares -p 445 192.0.2.10

Frequently Asked Questions

What does -oA do in Nmap?

The -oA <basename> flag saves scan results in all three major formats simultaneously: human-readable (.nmap), grepable (.gnmap), and structured XML (.xml) for importing into reporting tools.

Why does -sS require sudo privileges?

A TCP SYN scan (-sS) crafts raw Ethernet/IP packets rather than completing a full OS connect() syscall, which requires root or CAP_NET_RAW privileges.


Related Guides, Tools & Cheat Sheets