How To Use Nmap Command On Ubuntu?

Reading Time: 2 minutes

The Nmap or Network Mapper is an open-source tool that is used for network discovery and security auditing. It is useful for many systems and network administrators for tasks like network inventory, managing service upgrade schedules, and monitoring host or service uptime. It uses raw IP packets in novel ways to determine what hosts are available on the network, what services those hosts are offering, what OS they are running. Nmap is designed to scan systems rapidly but comes with the drawback that it works fine only against single hosts.


How to Install Nmap Command

Firstly, we have to install Nmap before exploring it. So it should be installed on your system. Open the terminal and type:

sudo apt install nmap

For verifying the installation, type the below command in the terminal:

nmap --version

How to Scan Hostname =

To perform a scan using hostname and IP address is the best way to run commands. For scanning a hostname, type the below command in the terminal:

nmap <webiste_url>

How to scan IP address using Nmap Command

sudo nmap <x.x.x.x>

How to Use verbose mode with Nmap

The -v command is used to get a more elaborative detail about the connected machine. So, type command in terminal:

nmap -v <webiste_url>

Using Nmap with IP address Range

It is easy to specify the IP range using the Nmap scanner tool, use the command given below:

nmap <x.x.x.x-x>

OS Detection

The tool helps to detect operating system and version as well running on the localhost. If you want to get OS details, you can use “-O”:

sudo nmap -O <webiste_url>

Firewall Detection

To check if the local host is using any Firewall, type “-sA” in the terminal:

sudo nmap -sA <x.x.x.x>

How to find a Live Host

To find a live host, Just type the below command in the terminal:

sudo nmap -sP <x.x.x.x>

Performing Fast Scan

It will perform a fast scan for the ports listed in Nmap services by using the below command:

sudo nmap -F <x.x.x.x>

Finding Host Interfaces and routes

To find the routes and hosts interface information, we can use the below command to perform the scan:

sudo nmap --iflist

Scaning a specific port using

If we want to scan a specific port and also want to list out its details then we can use Nmap here. For the same, we can use the below command:

sudo nmap -p 80 <website_url>

Also if we want to scan a particular port like TCP then we can use the command below:

sudo nmap

Nmap is a tool that comes in use for network scanning as we have seen above. Internet security companies use Nmap to scan a system and understand what weaknesses exist that a hacker could potentially exploit. This program is open-source and free, it is one of the most common tools used for scanning. network for open ports and other weaknesses. Hackers can gain access to uncontrolled ports on a system.

Whether you are a private user with important information on your system, a major corporation, or a government agency protecting a wealth of highly sensitive data, Nmap can provide the level of knowledge and pre-emptive thought required to keep things safe.

for more information, click here.

Written by 

Shubham Saini is a DevOps Engineer who loves to play with DevOps tools, Security methods and is also interested in Ethical Hacking & Cyber Security. He is a gamer also.