Skip to content

Linux nmap Guide

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Linux nmap Guide

Complete beginner-friendly guide to nmap on Linux, covering Arch Linux, CachyOS, and other distributions including network scanning, port scanning, and security auditing.


Table of Contents

  1. nmap Installation
  2. nmap Basics
  3. Port Scanning
  4. Network Scanning
  5. Advanced Scanning
  6. Troubleshooting

nmap Installation

Install nmap

Arch/CachyOS:

# Install nmap
sudo pacman -S nmap

Debian/Ubuntu:

sudo apt install nmap

Fedora:

sudo dnf install nmap

Verify Installation

Check nmap:

# Check version
nmap --version

# Check help
nmap --help

nmap Basics

Basic Scan

Scan host:

# Scan single host
nmap 192.168.1.1

# Scan hostname
nmap example.com

Scan Network

Scan range:

# Scan IP range
nmap 192.168.1.1-254

# Scan subnet
nmap 192.168.1.0/24

Port Scanning

Common Ports

Scan common ports:

# Scan common ports
nmap -F 192.168.1.1

# Fast scan
nmap --top-ports 100 192.168.1.1

All Ports

Scan all ports:

# Scan all ports
nmap -p- 192.168.1.1

# Or
nmap -p 1-65535 192.168.1.1

Specific Ports

Scan specific:

# Scan specific ports
nmap -p 22,80,443 192.168.1.1

# Scan port range
nmap -p 20-100 192.168.1.1

Network Scanning

Service Detection

Detect services:

# Detect services
nmap -sV 192.168.1.1

# Version detection
nmap -sV -p 22,80 192.168.1.1

OS Detection

Detect OS:

# OS detection
nmap -O 192.168.1.1

# Requires root
sudo nmap -O 192.168.1.1

Advanced Scanning

Stealth Scan

Stealth scanning:

# SYN scan (stealth)
sudo nmap -sS 192.168.1.1

# TCP scan
sudo nmap -sT 192.168.1.1

Aggressive Scan

Comprehensive scan:

# Aggressive scan
sudo nmap -A 192.168.1.1

# Includes OS, version, scripts

Troubleshooting

Permission Errors

Use sudo:

# Some scans require root
sudo nmap -sS 192.168.1.1

# Or use TCP scan
nmap -sT 192.168.1.1

Summary

This guide covered nmap installation, network scanning, and port scanning for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally