nmap command
Scan hosts for open ports and services.
- Networking
- Package nmap
- 6 options · 5 examples
Syntax
nmap [options] targetProvided by the nmap package. Run man nmap for the full manual.
Common options
| Option | What it does |
|---|---|
-p PORTS | Ports to scan, e.g. 22,80 or 1-1000 |
-sV | Detect service versions |
-sn | Ping scan only (find hosts) |
-F | Fast: top 100 ports |
-A | OS, versions, scripts and traceroute |
-Pn | Skip host discovery |
Examples
Scan the common ports of a host
nmap 192.0.2.10Scan specific ports
nmap -p 22,80,443 example.comScan all ports
nmap -p- 192.0.2.10Detect service versions
nmap -sV 192.0.2.10Find live hosts on a subnet
nmap -sn 192.0.2.0/24
No example matches. Check the options table or search the guides.
Tips
- Only scan hosts you own or have permission to test.
nmap guides
- How to Scan Open Ports with Nmap Linux Commands · Updated Apr 2025
