Nothing new here .  Just wanted to share some commands I are useful when performing network or direct systems testing using the nmap tool. The commands below will all display scan results in console while also saving to file.

 

Discover live hosts: 

nmap -n -sn -PE -oA live_hosts 10.0.0.0/24

Discover open TCP ports:

nmap -sS -vv -p- -oA tcp_ports_65535 10.0.0.2
nmap -sS -vv -p- -Pn –reason –open -oA tcp_ports_65535 10.0.0.2
nmap -sS -vv -p- -Pn –reason –max-rate 1 –open -oA tcp_ports_65535 10.0.0.2

 

Discover open UDP ports:

nmap -sU -vv -p- -oA udp_ports_65535 10.0.0.2

 

Discover services running on open UDP ports:

nmap -sU -sV -vv -A -O -p[port1],[port2] -oA open_udp_ports 10.0.0.2

Scan for most common 1000 TCP ports:

nmap -sS -sV -vv -A -O –top-ports 1000 –reason –open -oA tcp_ports_1000 10.0.0.2

Scan for most common 1000 UDP ports:

nmap -sU -sV -vv -A -O –top-ports 1000 –reason –open -oA udp_ports_1000 10.0.0.2