Nmap is a command line tool which allow scanning network and perform security audit. This tool provides the ability to find what devices are connected to the network, what services are available and what operating systems are running on these devices, which ports are open, etc.
This tutorial shows how to install Nmap on Ubuntu 22.04.
Update the package lists:
sudo apt update
Next, run the following command to install Nmap:
sudo apt install -y nmap
Once installation is completed, we can check Nmap version:
nmap command and give the IP address of a network device as argument:
The command prints which ports are open and what services are running on that device:
Nmap scan report for 192.168.0.151 Host is up (0.0019s latency). Not shown: 999 filtered ports PORT STATE SERVICE 80/tcp open http Nmap done: 1 IP address (1 host up) scanned in 4.84 seconds
You can also scan all local network. For example, the following command scans the local network where the address is 192.168.0.0/24:
If you want to completely remove Nmap and related dependencies, execute the following command:
sudo apt purge --autoremove -y nmap