Basic NMAP commands

NMAP(Network Mapping) is one of the important network monitoring tool. Which checks for what ports are opened on a machine.

Let us start with some examples to better understand nmap command:
Example1 : Scanning for a single port on a machine
nmap –p portnumber hostname

nmap -p 22

Example2 : Scan entire machine for checking open ports.
nmap hostname


Example3 : Scan remote machine for open ports
nmap remote-ip/host


Example4: Scan entire network for IP address and open ports.
nmap network ID/subnet-mask


Example5: Scan just ports, dont scan for IP address, hardware address, hostname, operating system name, version, and uptime etc. It’s very much fast as it said in man pages etc.
nmap –F hostname

nmap -F

Example6: Scan the machine and give as much details as possible.
nmap -v hostname

nmap -v

Example7 : Scan a machine for TCP open ports
nmap –sT hostname

nmap -sT

Example8 : Scan a machine for UDP open ports.
nmap –sU hostname

nmap -sU

Exmaple9 : Scanning for ports and to get what is the version of different services running on that machine
nmap –sV hostname

nmap -sV

Example10 : To check which protocol(not port) such as TCP, UDP, ICMP etc is supported by the remote machine. This -sO will give you the protocol supported and its open status.
nmap –sO hostname

nmap -sO localhost

Example11 : To scan a system for operating system and uptime details
nmap -O hostname

nmap -O