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. Now, let’s go use nmap command in Linux.

Install Nmap

CentOS

$ sudo yum install nmap.

Debian

$ sudo apt-get install nmap.

Ubuntu

$ sudo apt-get install nmap.

Syntax use nmap command

nmap [Scan Type] [Options] {Target}

Target

For example, Domain: www.huuphan.com, www.devopsroles.com. IP Address: 192.168.1.4, 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]

Options

-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 www.huuphan.com

# speified port only
$ nmap -v -PO -p 22 192.168.1.0/24

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

ping scan

$ nmap -v -sn 192.168.1.0/24

Check OS of specified IP

$ nmap -A 192.168.1.110

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

$ nmap -Pn --traceroute -p 443 www.huuphan.com

Conclusion

Nmap command is a simple command in Linux. It is tips and tricks for troubleshooting Linux. Thank you for reading the DevopsRoles page!

,

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 DevopsRoles.com 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.