Nmap Basic

How to list all the local network IP ?

nmap -sP 192.168.29.0/24

nmap -sP 192.10.10.0/24

nmap -sn 192.168.29.0/24


Multiple networks can be scanned at once ?

nmap 192.168.0.0/24 10.80.0.0/24

nmap -A -T4 14.98.29.241


Print All the Local Network IP To a File


nmap -sn 192.10.10.0/24 | awk '/Nmap scan/{gsub(/[()]/,"",$NF); print $NF > "Nmap-IP-List"}'

nmap -sn 192.168.29.0/24 | awk '/Nmap scan/{gsub(/[()]/,"",$NF); print $NF > "Nmap-IP-List"}'

nmap -sn 192.168.29.0/24 -oG nmap_output



Scanning specific ports

nmap -sV -p 22,443 192.168.29.0/24



The above flags have the following meanings:




If you want to extract only the IP addresses from the Nmap scan results and save them to a text file, you can use the grep command in conjunction with awk to extract the IP addresses and redirect the output to a file.


nmap -sn 192.168.1.0/24 | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' > ip_list.txt