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

Discover open TCP ports:

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


Discover open UDP ports:

nmap -sU -vv -p- -oA udp_ports_65535


Discover services running on open UDP ports:

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

Scan for most common 1000 TCP ports:

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

Scan for most common 1000 UDP ports:

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