How to install and use Nmap on Ubuntu 20.04

Welcome to today’s topic where we will be talking about how to install Nmap on Fedora 35.

Nmap (Network mapper) is a free and open-source software for network discovery and security auditing. It is also used for network inventory services, managing service upgrades, and monitoring hosts’ downtime.

Nmap is designed for bigger networks but it can also work fine with standalone hosts. Nmap suite includes an advanced GUI and results viewer called Zenmap, a flexible data transfer, redirection and a debugging tool called Ncat, a utility for comparing scan results called Ndiff, and a packet generation and response analysis tool called Nping.

Why use Nmap?

  • Nmap hs well writtend documentation for easy reference incase of difficulty.
  • Nmap supports a dozen advanced techniques out there
  • Most operating systems supports Nmap
  • Its free therefore maintained by the community.

What is Nmap used for?

  • It is used for port, OS and host scanning
  • It is used for checking the number of live hosts
  • It is used for checking which ports are open
  • It is used for checking which IPs are connecting to your network
  • It provide real time information of the network

Installing Nmap on Fedora 35

There are two ways to install Nmap:

  1. Installing Nmap from Binary RPMs
  2. Installing from the Yum repository
  3. Building and installing from the source

Related Articles

Installing Nmap on Ubuntu 20.04

1. Run system updates

Before we can begin our installation let’s run system updates in order to make it up to date

$ sudo apt update && apt upgrade -y

2. Install Nmap

To install Nmap run the following command

$ sudo apt install nmap -y

You will get the following as an output

Output
The following packages were automatically installed and are no longer required:
  libfprint-2-tod1 libgtkglext1 libllvm9 libminizip1 libpangox-1.0-0 shim
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  liblinear4 lua-lpeg nmap-common
Suggested packages:
  liblinear-tools liblinear-dev ncat ndiff zenmap
The following NEW packages will be installed:
  liblinear4 lua-lpeg nmap nmap-common
0 upgraded, 4 newly installed, 0 to remove and 137 not upgraded.
Need to get 5,412 kB of archives.
After this operation, 25.8 MB of additional disk space will be used.
Do you want to continue? [Y/n]

Press Y to allow installation to continue

You can check the Nmap version installed on Ubuntu 20.04

$ nmap --version
Nmap version 7.80 ( https://nmap.org )
Platform: x86_64-pc-linux-gnu
Compiled with: liblua-5.3.3 openssl-1.1.1d nmap-libssh2-1.8.2 libz-1.2.11 libpcre-8.44 libpcap-1.9.1 nmap-libdnet-1.12 ipv6
Compiled without:
Available nsock engines: epoll poll select

How to use Nmap on Ubuntu 20.04

Whenever you want to use Nmap you can use the command nmap -h

$ nmap -h

Nmap usage is like this

Usage: nmap [Scan Type(s)] [Options] {target specification}

Target specifications can be done by passing the hostname or the IP address

For example, to scan a network you should do the following:

$ nmap www.hostname.com

You will get the following as output

Output
Starting Nmap 7.80 ( https://nmap.org ) at 2022-01-11 21:34 EAT
Nmap scan report for www.nextgentips.com (172.67.202.129)
Host is up (0.026s latency).
Other addresses for www.nextgentips.com (not scanned): 104.21.76.248 2606:4700:3034::6815:4cf8 2606:4700:3032::ac43:ca81

PORT      STATE SERVICE
1/tcp     open  tcpmux
3/tcp     open  compressnet
4/tcp     open  unknown
6/tcp     open  unknown
7/tcp     open  echo
9/tcp     open  discard
13/tcp    open  daytime
......
Nmap done: 1 IP address (1 host up) scanned in 35.00 seconds

To scan multiple IP addresses you can do the following

$ nmap Ip address1 Ip address2 Ip adress3

Install nmap using snap

You can also install Nmap using the snap package. Snap is the best method because snap packages don’t require you to update manually because it does their updates on the background whenever a release is made.

$ sudo snap install nmap

Remove Nmap from Ubuntu 20.04

To uninstall Nmap from your system use the following command

$ sudo apt remove nmap
Output
The following packages will be REMOVED:
  nmap
0 upgraded, 0 newly installed, 1 to remove and 137 not upgraded.
After this operation, 4,499 kB disk space will be freed.
Do you want to continue? [Y/n] y

Conclusion

Congratulations, you have successfully learned how to install and use Nmap on Ubuntu 20.04. Continue learning more to gain more experience with it.

About Kipkoech Sang

I am a technology enthusiast who loves to share gained knowledge through offering daily tips as a way of empowering others. I am fan of Linux and all other things open source.
View all posts by Kipkoech Sang →

Leave a Reply

Your email address will not be published.