Lesson 01 of 5
What is Nmap? Install Nmap and Run Your First Scan
4 min read
What Nmap does, how to install it on Kali, Windows and Termux, and how to read your first scan.
Nmap (short for Network Mapper) is the most popular free tool for finding out what is running on a network. In one command it tells you which devices are online, which ports are open, and which software is listening on those ports. Ethical hackers use it in the first step of almost every pentest, and SOC analysts and network admins use it to check their own networks.
Nmap is free and open source. It was created by Gordon "Fyodor" Lyon in 1997 and it is still actively updated today.
What can Nmap do?
- Host discovery – find which machines on a network are switched on
- Port scanning – find open TCP and UDP ports
- Service and version detection – learn that port 80 runs Apache 2.4.7, not just "http"
- OS detection – guess whether the target is Linux, Windows, a router or a printer
- Nmap Scripting Engine (NSE) – run 600+ ready-made scripts that check for weak settings and known vulnerabilities
This course covers all of these, from basic to advanced, in five lessons.
Is it legal to use Nmap?
Nmap itself is legal. What matters is what you scan. Only scan systems you own, or systems you have written permission to test. Scanning someone else's server without permission can get your IP blocked, break the site's terms of service and land you in legal trouble under India's IT Act 2000.
Safe places to practise:
- scanme.nmap.org – a server the Nmap project set up so people can test against it (scan it a few times, don't hammer it)
- Your own lab – Kali Linux plus a vulnerable VM like Metasploitable 2 in VirtualBox
- TryHackMe and Hack The Box – legal online labs built for this
How to install Nmap
Kali Linux and Parrot OS – Nmap comes pre-installed. Check your version:
nmap --version
Ubuntu and Debian:
sudo apt update
sudo apt install nmap -y
Windows – download the installer from nmap.org/download. It also installs Zenmap (a graphical version of Nmap) and Npcap, which Nmap needs to send and capture packets.
Android (Termux):
pkg install nmap
macOS (Homebrew):
brew install nmap
Your first Nmap scan
Open a terminal and type:
nmap scanme.nmap.org
That's it. With no options, Nmap does three things:
- Turns the hostname into an IP address (a DNS lookup)
- Checks that the host is up
- Scans the 1,000 most common TCP ports
How to read Nmap output
- Nmap scan report for – the target and its IP address
- Host is up (0.21s latency) – the machine answered, and how quickly
- Not shown: 996 closed tcp ports – Nmap hides the boring ports so the list stays short
- PORT – the port number and protocol, like 22/tcp
- STATE – open, closed or filtered (Lesson 2 explains each one)
- SERVICE – the service that usually runs on that port. Here Nmap is only guessing from the port number. In Lesson 3 we'll make it check for real with -sV.
So from one short command we learned that scanme.nmap.org runs SSH on port 22 and a web server on port 80.
Different ways to give Nmap a target
nmap 192.168.1.10 # one IP
nmap 192.168.1.10 192.168.1.20 # two IPs
nmap 192.168.1.1-50 # a range
nmap 192.168.1.0/24 # a whole subnet (256 addresses)
nmap -iL targets.txt # targets from a file, one per line
nmap 192.168.1.0/24 --exclude 192.168.1.1 # skip one address
To find your own subnet, run ip a on Linux or ipconfig on Windows.
Should you run Nmap with sudo?
On Linux, Nmap behaves differently when it runs as root:
- With sudo, Nmap uses a fast SYN scan and can craft raw packets
- Without sudo, it falls back to a slower TCP connect scan
Both are fine for learning. Lesson 3 explains the difference properly.
Simple words mein (Hinglish)
Nmap ek free tool hai jo batata hai ki network par kaun-kaun se devices on hain, unke kaun se ports khule hain, aur un ports par kaunsa software chal raha hai. Kali Linux mein ye pehle se install aata hai. Bas nmap target likho aur scan shuru. Bas ek baat yaad rakho: sirf apna system ya jiski likhi hui permission ho, wahi scan karo.
FAQ
Is Nmap free? Yes. Nmap is free and open source on Linux, Windows and macOS.
Is Nmap a hacking tool? It's a network scanning tool. Attackers use it for recon, but admins, SOC teams and auditors use it every day to check their own networks.
Can Nmap hack a phone or a Wi-Fi password? No. Nmap finds devices, open ports and services. It doesn't crack passwords or break into devices.
What does the default Nmap scan do? It scans the 1,000 most common TCP ports, using a SYN scan if you run as root and a TCP connect scan if you don't.
Practice task
- Run nmap --version and note your version
- Scan scanme.nmap.org and write down every open port
- Scan your own router (usually 192.168.0.1 or 192.168.1.1) and compare the results
Next lesson: host discovery and port states – how Nmap decides a host is "up", and what open, closed and filtered really mean.