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 192.168.0.1

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

nmap 192.168.0.1

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

nmap 192.168.0.2

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

nmap 192.168.1.0/24

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 192.168.1.1

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

nmap -v 192.168.1.1

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

nmap -sT 192.168.1.1

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

nmap -sU 192.168.1.1

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

nmap -sV 192.168.1.1

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 192.168.1.1