Nmap Cheatsheet
April 21, 2026
Show IP addresses, hostname, and status sorted by IP
Using nmap to show ip addresses, hostname, and status, sorted by IP address.
nmap -sn -oG - 192.168.1.0/24 | sed 's/^Host: //' | sort -t . -k 3,3n -k 4,4n | column -t
# Nmap done at Fri Nov 5 08:05:18 2021 -- 256 IP addresses (21 hosts up) scanned in 1.69 seconds
192.168.1.1 (host1) Status: Up
192.168.1.2 (host2) Status: Up
192.168.1.3 (host3) Status: Up
...
Show IP and MAC addresses
Using nmap to show IP and mac address
nmap -sn 192.168.1.0/24
Starting Nmap 7.92 ( https://nmap.org ) at 2021-11-05 08:10 CDT
Nmap scan report for 192.168.1.1
Host is up (0.00032s latency).
MAC Address: 00:16:3E:11:11:11 (Xensource)
Nmap scan report for 192.168.1.2
Host is up (0.00013s latency).
MAC Address: 00:1B:21:11:11:11 (Intel Corporate)
Nmap scan report for 192.168.1.3
...
Scan for vulnerabilities
Now use nmap to scan for vulnerabilities
nmap -Pn -sV --script=vulners 192.168.1.0/24
...
445/tcp open netbios-ssn Samba smbd 4.6.2
| vulners:
| cpe:/a:samba:samba:4.6.2:
| SSV:93139 10.0 https://vulners.com/seebug/SSV:93139 *EXPLOIT*
...