How to use nmap command

In this tutorial, How to use NMAP Security Scanner on Linux. How to scan port, service name and ping v.v to target.

Install Nmap


$ sudo yum install nmap.


$ sudo apt-get install nmap.


$ sudo apt-get install nmap.


nmap [Scan Type] [Options] {Target}


For example, Domain:, IP Address:, 10.0.0-255.1-254

Scan Type

-sL:    List Scan -- simply list targets to scan
-sn:    Ping Scan -- disable port scan
-sP:    Ping Scan -- go no further than determining if host is online
-sS/sT/sA/sW/sM:    TCP SYN/Connect()/ACK/ Window/Maimon scans
-sV:    Probe open ports to determine service/version info
-sU:    UDP Scan
-sO:    IP protocol scan -- ICMP,EIGRP,
-b:    FTP bounce scan
-n/-R:    Never do DNS resolution/Always resolve[default: sometimes]


-p: Only scan specified ports
-O: Enable OS detection
-P0: Treat all hosts as online -- skip host discovery
-e: Use specified interface

nmap command examples

Scan port

# all ports
$ nmap -v -PO

# speified port only
$ nmap -v -PO -p 22

# post scan & service name
$ nmap -v -sV

ping scan

$ nmap -v -sn

Check OS of specified IP

$ nmap -A

Nmap option –traceroute to trace the route from the scanning machine to the target host

$ nmap -Pn --traceroute -p 443


nmap command is the simple command in Linux. It is tips and tricks for troubleshooting Linux.


About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment moderation is enabled. Your comment may take some time to appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.