Overview
Nmap (Network Mapper) is the reference tool for network discovery and security auditing. Point it at a host or range you own or are authorized to assess and it reports which hosts are up, which ports are open, what services answer, and — with OS detection — what is likely running underneath. Almost every authorized assessment starts here, because you cannot secure what you have not mapped. Defenders run it on their own infrastructure to find forgotten exposures before attackers do: the unpatched camera, the database port answering the whole internet, the test server nobody took down. Every probe Nmap sends goes to a target you named, so keep scans inside your authorized scope and rate-limit wide ranges.Seeing requires root privileges? Which scan types need raw sockets, and what still works unprivileged.
Key features
- Host discovery, port scanning and service version detection
- OS fingerprinting and traceroute mapping
- NSE scripting engine with hundreds of audit scripts
- Output in XML, JSON-friendly and grepable formats
- Stealth, timing and decoy options for authorized evasion testing
- Free and open source — the industry baseline scanner
Install & first run
# Debian / Ubuntu / Kali
sudo apt install nmap
## macOS
brew install nmap
# Fast ping sweep of your lab subnet
nmap -sn 192.168.1.0/24
# Service and version detection on one host
nmap -sV 192.168.1.10
# OS detection plus default scripts (slower, noisier)
sudo nmap -A 192.168.1.10
Real-world example
A client authorizes a black-box review of their office network. Start with a ping sweep of the provided lab range to list live hosts, then run service detection on each one. The resulting host-port-service inventory becomes the scope map for everything that follows — and any host answering that is not on the client's asset list becomes finding number one.
Common questions
Is Nmap free?
Yes. Nmap is free and open source.
Which script category should I start with?
default (-sC) for safe discovery, then vuln or discovery scoped to the ports you found. Never run vuln against hosts you do not own.
Why does the scan say 'filtered'?
A firewall is dropping the probes. Try -Pn to skip host discovery and a slower -T2 timing profile before concluding the host is down.
Is -A too noisy?
-A turns on OS detection, version detection, scripts and traceroute at once. On a real engagement use the individual flags so you know what caused each alert.
Related tools
Masscan
The fastest internet-scale port scanner: sweep entire ranges in minutes on your authorized targets. Free, open source.
Related reading: Nmap vs Masscan: Network Port Scanner Comparison · Nmap vs RustScan: Port Scanning Speed Compared · Nmap Command Cheat Sheet: Discovery, Stealth & NSE
Keep exploring: browse every assessment phase in the Pentest Hub.
Authorized testing only — only ever test systems you own or have explicit written permission to assess.
