~2 min read • Updated Jul 21, 2025
1. What Is nmap?
nmap is a free and open-source utility for scanning networks and hosts. It’s widely used for security assessments, troubleshooting, and inventory gathering. It can detect hosts, open ports, services, and more.
2. Installing nmap
Use your package manager to install:
sudo apt install nmap # Debian / Ubuntu
sudo yum install nmap # CentOS / RHEL
sudo pacman -S nmap # Arch Linux3. Scan a Host for Open Ports
nmap 192.168.1.14. Detect Running Services and Their Versions
nmap -sV 192.168.1.15. Detect Operating System
sudo nmap -O 192.168.1.16. Ping Sweep to Discover Active Devices
nmap -sn 192.168.1.0/247. Scan UDP Ports
sudo nmap -sU 192.168.1.18. Scan Specific Ports or Port Range
nmap -p 22,80,443 192.168.1.1
nmap -p 1-1000 192.168.1.19. Use NSE Scripts (Nmap Scripting Engine)
nmap --script http-enum 192.168.1.110. Save Output to File
nmap -oN report.txt 192.168.1.1
nmap -oX report.xml 192.168.1.111. Security and Ethics
- Always get permission before scanning external networks
- Be aware of detection by firewalls or intrusion detection systems
- Use stealth flags responsibly during penetration testing
12. Conclusion
nmap is a versatile and essential tool for Linux administrators and security engineers. With its powerful scanning techniques, script integration, and detailed output, it facilitates network inventory, vulnerability detection, and systems analysis across environments.
Written & researched by Dr. Shahin Siami