Nmap Cheat Sheet
Nmap Cheat Sheet
Table of
Contents
https://www.stationx.net/nmap-cheat-sheet/ 1
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
Download your own copy of this cheat sheet here.
Now, let’s get to the Nmap commands.
Target Specification
SWITCH EXAMPLE DESCRIPTION
nmap 192.168.1.1
Scan specific IPs
192.168.2.1
nmap
Scan a domain
scanme.nmap.org
https://www.stationx.net/nmap-cheat-sheet/ 2
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
nmap
-sS 192.168.1.1 TCP SYN port scan (Default)
-sS
nmap
-sU 192.168.1.1 UDP port scan
-sU
nmap
-sA 192.168.1.1 TCP ACK port scan
-sA
nmap
-sW 192.168.1.1 TCP Window port scan
-sW
https://www.stationx.net/nmap-cheat-sheet/ 3
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
nmap
-sM TCP Maimon port scan
192.168.1.1
-sM
Host Discovery
SWITCH EXAMPLE DESCRIPTION
nmap
Disable port scanning.
-sn 192.168.1.1/24 -
Host discovery only.
sn
nmap
ARP discovery on local
-PR 192.168.1.1-1/24
network
-PR
https://www.stationx.net/nmap-cheat-sheet/ 4
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
nmap 192.168.1.1 Never do DNS
-n
-n resolution
UDP por
Generate
Port Specification
SWITCH EXAMPLE DESCRIPTION
nmap
-p 192.168.1.1 -p Port scan for port x
21
nmap
-p 192.168.1.1 -p Port range
21-100
https://www.stationx.net/nmap-cheat-sheet/ 5
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
nmap
192.168.1.1 -p Port scan multiple TCP
-p
U:53,T:21- and UDP ports
25,80
nmap
-p Port scan all ports
192.168.1.1 -p-
nmap
Port scan from service
-p 192.168.1.1 -p
name
http,https
nmap
-F Fast port scan (100 ports)
192.168.1.1 -F
nmap
-top-
192.168.1.1 - Port scan the top x ports
ports
top-ports 2000
https://www.stationx.net/nmap-cheat-sheet/ 6
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
-sV 192.168.1.1 - version of the service
sV running on port
nmap
-sV - Intensity level 0 to 9.
192.168.1.1 -
version- Higher number increases
sV -version-
intensity possibility of correctness
intensity 8
nmap
-sV - Enable light mode. Lower
192.168.1.1 -
version- possibility of correctness.
sV -version-
light Faster
light
Enables OS detection,
nmap
-A version detection, script
192.168.1.1 -A
scanning, and traceroute
OS Detection
SWITCH EXAMPLE DESCRIPTION
nmap
Remote OS detection using
-O 192.168.1.1
TCP/IP stack fingerprinting
-O
https://www.stationx.net/nmap-cheat-sheet/ 7
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
limit limit against host
nmap
-O -
192.168.1.1 Makes Nmap guess more
osscan-
-O -osscan- aggressively
guess
guess
nmap
-O - Set the maximum number x of
192.168.1.1
max- OS detection tries against a
-O -max-
os-tries target
os-tries 1
Paranoid (0)
-T0 nmap 192.168.1.1 -T0 Intrusion Detection
System evasion
Aggressive (4)
speeds scans;
assumes you are on
-T4 nmap 192.168.1.1 -T4
a reasonably fast
and reliable
network
Give up on
1s; 4m;
-host-timeout <time> target after this
2h
long
-min-rtt-timeout/max-rtt-
1s; 4m; Specifies probe
timeout/initial-rtt-
2h round trip time
timeout <time>
Parallel host
https://www.stationx.net/nmap-cheat-sheet/ 9
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
-min-parallelism/max- Probe
10; 1
parallelism <numprobes> parallelization
Specify the
maximum
-max-retries <tries> 3 number of port
scan probe
retransmissions
Send packets
no slower
-min-rate <number> 100
than <number>
per second
Send packets
no faster
-max-rate <number> 100
than <number>
per second
NSE Scripts
SWITCH EXAMPLE DESCRIPTION
https://www.stationx.net/nmap-cheat-sheet/ 10
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
Scan with default
Scan with a
nmap 192.168.1.1 -
-script wildcard. Example
script=http*
http
Fast search
nmap -n -Pn -p 80 -open -sV -vvv -
for random
script banner,http-title -iR 1000
web servers
Brute forces
DNS
nmap -Pn -script=dns-brute
hostnames
domain.com
guessing
subdomains
Detect cross
nmap -p80 -script http-unsafe-
site scripting
output-escaping scanme.nmap.org
vulnerabilities
Check for
nmap -p80 -script http-sql-injection
SQL
scanme.nmap.org
injections
https://www.stationx.net/nmap-cheat-sheet/ 12
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
-f nmap 192.168.1.1 -f
00:00 00:00 1
nmap -D
-D 192.168.1.101,192.168.1.102,192.168.1.103,192.168.1.23
192.168.1.1
nmap -D decoy-ip1,decoy-ip2,your-own-ip,decoy-
-D
ip3,decoy-ip4 remote-host-ip
-g nmap -g 53 192.168.1.1
https://www.stationx.net/nmap-cheat-sheet/ 13
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
-data-
nmap -data-length 200 192.168.1.1
length
Output
SWITCH EXAMPLE DESCRIPTION
nmap
Normal output to the file
-oN 192.168.1.1 -oN
normal.file
normal.file
nmap
XML output to the file
-oX 192.168.1.1 -oX
xml.file
xml.file
nmap
Grepable output to the
-oG 192.168.1.1 -oG
file grep.file
grep.file
nmap
Output in the three
-oA 192.168.1.1 -oA
major formats at once
results
https://www.stationx.net/nmap-cheat-sheet/ 14
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
-oG - 192.168.1.1 -oG screen. -oN -, -oX - also
- usable
nmap
-
192.168.1.1 -oN Append a scan to a
append-
file.file -append- previous scan file
output
output
Increase debugging
nmap
-d level (use -dd or more
192.168.1.1 -d
for greater effect)
nmap
Only show open (or
-open 192.168.1.1 -
possibly open) ports
open
nmap
-packet- Show all packets sent
192.168.1.1 -T4
trace and received
-packet-trace
nmap -resume
-resume Resume a scan
https://www.stationx.net/nmap-cheat-sheet/ 15
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
results.file
nmap help
-h nmap -h
screen
nmap 192.168.1.1-50
Query the Internal DNS for
-sL -dns-server
hosts, list targets only
192.168.1.1
https://www.stationx.net/nmap-cheat-sheet/ 17
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
first go-to tool you will use in the scanning and
enumeration stage of many assessments, setting
the foundation for the rest of your pentest.
Is it OK to Nmap Google?
Is Nmap a vulnerability?
https://www.stationx.net/nmap-cheat-sheet/ 18
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
https://www.stationx.net/nmap-cheat-sheet/ 19
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
Level Up in Cyber
Security: Join Our
Membership Today!
https://www.stationx.net/nmap-cheat-sheet/ 20
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
Nathan House
Nathan House is the founder and CEO of StationX. He
has over 25 years of experience in cyber security, where
he has advised some of the largest companies in the
world. Nathan is the author of the popular "The Complete
Cyber Security Course", which has been taken by over
half a million students in 195 countries. He is the winner
of the AI "Cyber Security Educator of the Year 2020"
award and finalist for Influencer of the year 2022.
Related Articles
https://www.stationx.net/nmap-cheat-sheet/ 21
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
93 comments
Oldest comments first
Comment as a guest:
Name
Save the details above in this browser for the next time I comment
Submit comment
Milton
Reply to Milton
Jimmy Toriola
Eddie
July 21, 2017
https://www.stationx.net/nmap-cheat-sheet/ 24
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
Reply to Eddie
Oliver Suzuki
July 21, 2017
Fran
Reply to Fran
https://www.stationx.net/nmap-cheat-sheet/ 25
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
Celestino J
July 24, 2017
Great news.
In expectation of this course.
As usual ,
Thanks for what you doing.
Reply to Celestino J
Marious
October 18, 2017
Reply to Marious
https://www.stationx.net/nmap-cheat-sheet/ 26
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
Arthur
November 2, 2017
14
Reply to Arthur
nathan
April 26, 2022
your welcome
Reply to nathan
Horacio Castellini
December 1, 2017
2
https://www.stationx.net/nmap-cheat-sheet/ 27
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
2
krishna
December 11, 2017
Reply to krishna
Nathan House
https://www.stationx.net/nmap-cheat-sheet/ 28
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
Abdulrahman Mogram
December 31, 2017
reike
January 10, 2018
Reply to reike
Nathan House
https://www.stationx.net/nmap-cheat-sheet/ 29
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
sudo
Hi
Reply to sudo
Suraj
Thank you
Reply to Suraj
Nathan House
Manik
August 1, 2018
Great stuff!
Reply to Manik
https://www.stationx.net/nmap-cheat-sheet/ 33
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
Nathan House
August 4, 2018
DEM
September 1, 2018
2
https://www.stationx.net/nmap-cheat-sheet/ 34
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
2
Reply to DEM
Nathan House
September 1, 2018
-sn just finds hosts that are up. No port scan. -Pn is
the opposite. No host discovery. Port scan if it
appears up or not.
Aetos
September 24, 2021
Pn is for no ping
command which dosen’t TCP handshake
Reply to Aetos
https://www.stationx.net/nmap-cheat-sheet/ 35
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
tad
September 2, 2018
hi sir ,
i just wanna know , is there any benefit for this -sL
option ? and when do i use -P0 ?
Reply to tad
Nathan House
September 2, 2018
tad
September 3, 2018
Reply to tad
Nathan House
https://www.stationx.net/nmap-cheat-sheet/ 38
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
Nathan House
September 3, 2018
UJJWAL
July 2, 2019
Reply to UJJWAL
https://www.stationx.net/nmap-cheat-sheet/ 39
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
Leslie
September 10, 2021
Reply to Leslie
Count
Reply to Count
https://www.stationx.net/nmap-cheat-sheet/ 40
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
Nathan House
Gald to help!
Nathan House
https://www.stationx.net/nmap-cheat-sheet/ 41
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
How can I help?
Wangol Joel
June 16, 2019
INFO
Affiliates
Legal Notices
https://www.stationx.net/nmap-cheat-sheet/ 42
Nmap Cheat Sheet 2024: All the Commands, Flags & Switches 12/14/23 00:45
Privacy Policy
Site Map
Careers
SECURITY ASSESSMENT
Penetration Testing
Vulnerability Scanning
Build Reviews
Social Engineering
CONSULTING
Incident Response
Security Architecture
Risk Assessment
Security Training
https://www.stationx.net/nmap-cheat-sheet/ 43