← All tools

Nmap

Tool manual · Kali & common usage

Network · Beginner · Network lane

BeginnerNetwork Scanner
Authorized usage only. Capture and inspect traffic only on systems and networks you own or have written permission to analyze.

What is Nmap?

Nmap (Network Mapper) discovers hosts and services on a network by sending crafted probes and interpreting responses.

Asset discovery, open-port inventory, service/version detection, and basic scripted checks — only on authorized targets.

Official website: Nmap · Documentation

When do you use it?

  • Map what is listening on your lab VM or approved scope.
  • Verify firewall rules after a change.
  • Find service versions before deeper testing (authorized).

When not to use it

  • Do not scan the public internet or third-party networks without written permission.
  • Aggressive timing (-T5) on production can cause outages — use carefully.

Who uses it?

  • Pentesters
  • Sysadmins
  • Blue team (validation)
  • Students in labs

How do you use it? (typical flow)

  1. Define target (IP, range, or hostname in scope).
  2. Choose scan type (e.g. -sT connect, -sS SYN if root).
  3. Optionally -sV for versions, -p for ports, -oN/-oA for output.
  4. Document findings; never treat Nmap alone as full exploitation.

Help & manual (like man / --help)

Every serious tool has a built-in way to look up flags. Learn these first so you are not stuck memorizing every option.

  1. 1. Help

    nmap -h

    Quick flag overview.

  2. 2. Man page

    man nmap

    Complete reference.

  3. 3. Official book/docs

    https://nmap.org/book/man.html

    Authoritative option guide.

Kali Linux

Preinstalled on Kali. Package: nmap. Default tool for host/port discovery.

1. Installation

OSInstallation
Kali LinuxPreinstalled on Kali. Package: nmap. Default tool for host/port discovery.
Debian/Ubuntusudo apt install nmap
macOSbrew install nmap
WindowsInstaller from nmap.org

2. Basic commands

  1. 1. Quick local scan

    nmap 127.0.0.1

    Common ports on localhost.

  2. 2. Service versions

    nmap -sV 127.0.0.1

    Detect service/version where possible.

  3. 3. Specific ports

    nmap -p 22,80,443 127.0.0.1

    Limit port set.

  4. 4. Official test host

    nmap scanme.nmap.org

    Only host Nmap authorizes publicly.

  5. 5. Save output

    nmap -oN scan.txt 127.0.0.1

    Normal output file.

Options / flags

OptionPurpose
-sVService/version detection
-sCDefault NSE scripts
-p <ports>Port list or range
-T0..5Timing template (slower → stealthier / safer)
-PnSkip host discovery (treat host as up)
-oA nameSave all major output formats

5. Useful features

  • Host discovery
  • Scan types (-sS, -sT, -sU)
  • Version detection
  • NSE scripts
  • Output formats

6. Practical examples

  1. Example 1: Quick local scan

    nmap 127.0.0.1

    Common ports on localhost.

  2. Example 2: Service versions

    nmap -sV 127.0.0.1

    Detect service/version where possible.

  3. Example 3: Specific ports

    nmap -p 22,80,443 127.0.0.1

    Limit port set.

  4. Example 4: Official test host

    nmap scanme.nmap.org

    Only host Nmap authorizes publicly.

  5. Example 5: Save output

    nmap -oN scan.txt 127.0.0.1

    Normal output file.

7. Important notes

  • Used by sysadmins for asset inventory and by defenders to verify firewall rules.
  • Authorized targets only — labs, systems you own, or written permission.
  • Prefer reading --help / man / official docs for your installed version; flags change over time.

Related course: networking fundamentals · network security · Commands: /commands#networking