Jay Abhani
Senior Web Development Instructor at almaBetter
Master Nmap with this ultimate Nmap cheat sheet! Learn essential commands, flags, options, and scanning techniques to elevate your network security skills
Nmap (Network Mapper) is a powerful, open-source tool for network discovery and security auditing. Whether you're a network administrator, cybersecurity enthusiast, or ethical hacker, this Nmap Cheat Sheet will guide you through the essential commands, switches, and options to maximize your efficiency with Nmap.
Nmap is a versatile tool that scans networks and hosts to gather information like open ports, services running, and system details. It is widely used for:
Before diving into the commands, ensure you have Nmap installed. You can download it from the official Nmap website. Installation instructions vary by operating system (Windows, Linux, macOS).
All Nmap commands follow a basic syntax:
nmap [options] [target]
You can install Nmap on various platforms:
Once installed, you can begin running Nmap commands via the terminal or command prompt.
Host discovery helps you identify which systems are live on a network. This is often the first step in any network scan.
A ping scan is the most basic way to identify active hosts in a network:
nmap -sn 192.168.1.0/24
If ICMP echo requests are blocked by a firewall, you can instruct Nmap to treat hosts as up:
nmap -Pn 192.168.1.1
Port scanning identifies open and closed ports on a host. Here’s an Nmap scan cheat sheet for common scans:
To scan specific ports, use the -p option followed by the port numbers or a range:
nmap -p 22,80 192.168.1.1
You can scan all 65,535 ports with the following command:
nmap -p- 192.168.1.1
To scan only the most common 100 ports, use the -F flag for a faster scan:
nmap -F 192.168.1.1
Identify the services running on open ports and their versions:
To detect the services and their versions, use the -sV flag:
nmap -sV 192.168.1.1
This will provide a detailed list of services running on each open port, including the version numbers.
You can run an aggressive scan to gather detailed information about the host. This includes OS detection, version detection, script scanning, and traceroute:
nmap -A 192.168.1.1
Understand the target’s operating system using these Nmap options cheat sheet commands:
Nmap can be used to identify the operating system of a remote host, which is essential in vulnerability assessments.
To detect the operating system of the target:
nmap -O 192.168.1.1
nmap -A 192.168.1.1
Use Nmap scripts to detect vulnerabilities. This Nmap vulnerability scan cheat sheet showcases its power:
Nmap has the ability to perform vulnerability assessments by using pre-built scripts designed to detect common security issues. This is particularly useful for penetration testers.
You can use the --script option to run scripts designed for vulnerability detection. The most common vulnerability scan script is vuln:
nmap --script vuln 192.168.1.1
You can also run specific vulnerability scripts by specifying their names:
nmap --script smb-vuln-ms17-010 192.168.1.1
Conduct scans designed to avoid detection:
Stealth scanning techniques, such as the SYN scan, can help avoid detection by firewalls or intrusion detection systems (IDS).
nmap -sS 192.168.1.1
Scan UDP ports:
Nmap can also be used to scan UDP ports, which are often ignored in regular port scans:
nmap -sU 192.168.1.1
Bypass firewalls or IDS/IPS:
nmap -D RND:10 192.168.1.1
nmap --source-port 53 192.168.1.1
Save results for analysis:
nmap -oN output.txt 192.168.1.1
nmap -oX output.xml 192.168.1.1
nmap -oG output.gnmap 192.168.1.1
Efficiently combine Nmap flags cheat sheet entries to customize scans:
nmap -sS -p 80,443 -A -oN scan_report.txt 192.168.1.1
nmap -T4 -sS --script vuln 192.168.1.1
This performs a fast, stealthy scan and runs vulnerability scripts to identify known security issues.
Speed up your scans with these Nmap switches cheat sheet options:
Nmap provides various options for optimizing scan performance. These are particularly helpful when scanning large networks or when speed is a priority.
nmap -T4 192.168.1.0/24
If you want to control the number of packets Nmap sends per second, use the --min-rate option:
nmap --min-rate 1000 192.168.1.1
Nmap allows you to save the results of your scans in various formats, making it easy to analyze the results later.
nmap -oN output.txt 192.168.1.1
For machine-readable output, use XML format:
nmap -oX output.xml 192.168.1.1
If you need results in a format that can be easily parsed or searched:
nmap -oG output.gnmap 192.168.1.1
Explore these handy references:
This Nmap Cheat Sheet is a comprehensive resource to help you master network scanning. From simple host discovery to advanced vulnerability assessments, these commands and options empower you to effectively analyze and secure networks. Remember to use Nmap ethically and with permission when exploring networks.
More Cheat Sheets and Top Picks