Nmap on Parrot Linux: 15 Essential Commands for Beginners

This tutorial is for authorized testing only: run every command against your own machines or a home lab such as a Parrot Linux pentesting lab with DVWA or Metasploitable, never against systems you do not own or have written permission to test.

Nmap is the network scanner you will reach for most on Parrot Linux. It is already installed on the Security and Hack The Box editions, and it is the first tool most people learn when they move from reading about networks to actually mapping one. This guide walks you through 15 essential nmap parrot linux commands, what each flag does, and how to read the output, so you stop copying one-liners and start understanding your scans.

Check your Nmap install on Parrot Linux

Open a terminal and confirm the version:

nmap --version

If the command is missing (for example on a Home edition), install it from the Parrot repositories:

sudo apt update
sudo apt install nmap

Parrot is Debian-based, so apt is the correct package manager here. If downloads crawl, fix your mirror first with our guide on changing the Parrot Linux mirror.

Set up a safe target

Before scanning anything, give yourself a legal target. The simplest options are scanme.nmap.org (the Nmap project runs it for exactly this purpose and asks you to keep scans gentle) and a Metasploitable 2 virtual machine on your own network. From here on, replace TARGET with your own lab IP such as 192.168.56.101.

The first five: discovery and basic scans

1. Scan a single host

nmap TARGET

With no flags, Nmap runs a TCP SYN scan (as root) of the 1,000 most common ports and prints which are open, closed or filtered. This is your baseline.

2. Scan a whole subnet

nmap 192.168.56.0/24

CIDR notation scans every host in the range. On a lab network this quickly shows you which machines are alive.

3. Ping sweep only (no port scan)

nmap -sn 192.168.56.0/24

The -sn flag does host discovery without scanning ports. Use it when you only want a list of live hosts.

4. Scan specific ports

nmap -p 22,80,443 TARGET

Name the ports you care about with -p. Use -p- to scan all 65,535 ports when you have time to spare.

5. Fast scan of the top 100 ports

nmap -F TARGET

The -F (fast) flag limits the scan to the 100 most common ports, which is handy for a quick look.

The next five: service, version and OS detection

6. Detect service versions

nmap -sV TARGET

-sV probes open ports to work out which software and version is listening. This turns “port 21 is open” into “vsftpd 2.3.4 is running,” which is far more useful.

7. Guess the operating system

sudo nmap -O TARGET

OS detection needs root, so run it with sudo. Nmap compares TCP/IP behaviour against its fingerprint database and prints its best guesses.

8. The aggressive scan

sudo nmap -A TARGET

-A bundles version detection, OS detection, default scripts and traceroute. It is noisy and slow, but it gives you the most information in one command.

9. Control timing

nmap -T4 TARGET

Timing templates run from -T0 (paranoid, very slow) to -T5 (insane, very fast). -T4 is a sensible default on a reliable lab network; drop to -T2 on fragile or shared links.

10. UDP scan

sudo nmap -sU TARGET

Many services (DNS, SNMP, DHCP) live on UDP. These scans are slow because UDP is connectionless, so limit the port range with -p when you can.

The last five: scripts, output and evasion basics

11. Run default NSE scripts

nmap -sC TARGET

The Nmap Scripting Engine (NSE) automates checks. -sC runs the safe default set, surfacing things like SSL certificate details and anonymous FTP access.

12. Run a specific script category

nmap --script vuln TARGET

--script lets you choose categories or individual scripts. The vuln category checks for known weaknesses on your lab host. Only run this against machines you are authorized to test.

13. Save output to all formats

nmap -A -oA myscan TARGET

-oA writes normal, grepable and XML output at once (myscan.nmap, myscan.gnmap, myscan.xml). Keeping records is good practice for any structured test.

14. Scan from a target list

nmap -iL hosts.txt

Put one IP or hostname per line in hosts.txt and feed it with -iL. This scales a scan without a huge one-line command.

15. Verbose and reason output

nmap -v --reason TARGET

-v increases verbosity and --reason explains why Nmap marked each port open, closed or filtered. When a scan surprises you, these two flags usually explain it.

Reading the results

Every scan lists ports in three main states. Open means a service accepted the probe. Closed means the host replied but nothing is listening. Filtered means a firewall dropped the probe, so Nmap could not tell. If you are testing your own machine and seeing unexpected filtered ports, review your Parrot Linux firewall setup. If scans feel sluggish, our notes on speeding up a slow Parrot system can help, since Nmap is CPU and network bound.

Once you are comfortable mapping hosts, the natural next step is turning findings into verified exploits in a lab. See how Parrot compares with the other popular pentest distro in our Parrot OS vs Kali Linux breakdown.

FAQ

Is Nmap installed by default on Parrot Linux?

On the Security and Hack The Box editions, yes. On the Home edition you may need sudo apt install nmap. Check with nmap --version.

Do I need root to run Nmap?

Basic connect scans work as a normal user, but SYN scans, OS detection (-O) and UDP scans (-sU) need root, so run those with sudo.

Is it legal to scan any website with Nmap?

No. Scan only systems you own or have explicit written permission to test. Use scanme.nmap.org or your own lab VMs for practice.

A sensible scanning workflow

Memorising flags is less important than having a repeatable order of work. Most structured tests against a lab follow the same four stages, and the commands above slot into each one.

Stage one is discovery. Start wide and cheap. A ping sweep with -sn across your lab subnet tells you which hosts are alive before you spend time on ports. On a home lab this is usually a handful of virtual machines, but the habit matters: you never want to assume a host is down just because one probe failed. If a firewall is blocking ICMP, add -Pn to skip host discovery and treat every address as up, at the cost of a slower scan.

Stage two is enumeration. Now you look at ports and services on the live hosts. Run a default scan first, then layer on -sV for version detection once you know which ports are open. Version strings are where most of your leads come from: an outdated service with a known weakness is far more interesting than a bare open port. Resist the urge to jump straight to -A on every host; the aggressive scan is loud and slow, and on a real engagement that noise gets you noticed.

Stage three is targeted scripting. With a service and version in hand, point specific NSE scripts at it. If you found an SMB service, the smb-* scripts tell you far more than a generic scan. The --script flag accepts comma-separated names, so you can combine a few relevant checks in one run and keep the output focused.

Stage four is recording. Save everything with -oA as you go. When you later try to reproduce a finding, your own scan files are the fastest way back to it, and they form the evidence trail for any report you write.

Common beginner mistakes

Three mistakes trip up almost everyone starting out on Parrot. The first is scanning the wrong thing: double-check the IP before you press enter, because a typo can point a --script vuln run at a machine you had no business touching. The second is ignoring timing: running -T5 against a flaky Wi-Fi link produces missed ports and false negatives, so match the timing template to the quality of the connection. The third is misreading filtered as closed. A filtered result means a firewall ate the probe, not that the port is safe; add --reason and, where appropriate, try a different scan type before you draw conclusions.

One more practical note for lab work: if you run your targets as Docker containers rather than full virtual machines, remember that container networking changes which addresses are reachable. Our guide on installing Docker on Parrot Linux covers getting that environment set up cleanly so your scans hit what you expect.