Debian / Ubuntu Linux: Install nmap command Software For Scanning Network

How do I install nmap command under a Debian or Ubuntu Linux based system for testing security of my own network?

Nmap is a command line tool for network exploration or security auditing.
Tutorial details
Difficulty Easy (rss)
Root privileges Yes
Requirements None
Time N/A
It supports ping scanning (determine which hosts are up), many port scanning techniques (determine what services the hosts are offering), and TCP/IP fingerprinting (remote host operating system identification).
how to install nmap command on debian ubuntu linux using apt-get
This page shows how to install nmap command on a Debian or Ubuntu Linux based system.



To install nmap for Debian and Ubuntu Linux based server systems type the following apt command or apt-get command:
$ sudo apt-get install nmap
Sample outputs:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  liblinear3 ndiff python-bs4 python-html5lib python-lxml python-webencodings
Suggested packages:
  liblinear-tools liblinear-dev python-genshi python-lxml-dbg python-lxml-doc
The following NEW packages will be installed:
  liblinear3 ndiff nmap python-bs4 python-html5lib python-lxml python-webencodings
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 6,518 kB of archives.
After this operation, 29.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 artful/main amd64 liblinear3 amd64 2.1.0+dfsg-2 [39.3 kB]
Get:2 artful/main amd64 python-bs4 all 4.6.0-1 [67.9 kB]
Get:3 artful/main amd64 python-webencodings all 0.5-2 [10.3 kB]
Get:4 artful/main amd64 python-html5lib all 0.999999999-1 [83.6 kB]
Get:5 artful/main amd64 python-lxml amd64 4.0.0-1 [1,120 kB]
Get:6 artful/main amd64 ndiff all 7.60-1ubuntu1 [20.4 kB]                                                                                                                     
Get:7 artful/main amd64 nmap amd64 7.60-1ubuntu1 [5,176 kB]                                                                                                                   
Fetched 6,518 kB in 22s (284 kB/s)                                                                                                                                                                                
Selecting previously unselected package liblinear3:amd64.
(Reading database ... 196139 files and directories currently installed.)
Preparing to unpack .../0-liblinear3_2.1.0+dfsg-2_amd64.deb ...
Unpacking liblinear3:amd64 (2.1.0+dfsg-2) ...
Selecting previously unselected package python-bs4.
Preparing to unpack .../1-python-bs4_4.6.0-1_all.deb ...
Unpacking python-bs4 (4.6.0-1) ...
Selecting previously unselected package python-webencodings.
Preparing to unpack .../2-python-webencodings_0.5-2_all.deb ...
Unpacking python-webencodings (0.5-2) ...
Selecting previously unselected package python-html5lib.
Preparing to unpack .../3-python-html5lib_0.999999999-1_all.deb ...
Unpacking python-html5lib (0.999999999-1) ...
Selecting previously unselected package python-lxml.
Preparing to unpack .../4-python-lxml_4.0.0-1_amd64.deb ...
Unpacking python-lxml (4.0.0-1) ...
Selecting previously unselected package ndiff.
Preparing to unpack .../5-ndiff_7.60-1ubuntu1_all.deb ...
Unpacking ndiff (7.60-1ubuntu1) ...
Selecting previously unselected package nmap.
Preparing to unpack .../6-nmap_7.60-1ubuntu1_amd64.deb ...
Unpacking nmap (7.60-1ubuntu1) ...
Processing triggers for libc-bin (2.26-0ubuntu2) ...
Setting up python-bs4 (4.6.0-1) ...
Setting up python-lxml (4.0.0-1) ...
Processing triggers for man-db ( ...
Setting up liblinear3:amd64 (2.1.0+dfsg-2) ...
Setting up python-webencodings (0.5-2) ...
Setting up nmap (7.60-1ubuntu1) ...
Setting up ndiff (7.60-1ubuntu1) ...
Setting up python-html5lib (0.999999999-1) ...
Processing triggers for libc-bin (2.26-0ubuntu2) ...


To find the nmap version, enter:
# nmap -V
# nmap --version
Sample outputs:

Nmap version 7.60 ( )
Platform: x86_64-pc-linux-gnu
Compiled with: liblua-5.3.3 openssl-1.0.2g nmap-libssh2-1.8.0 libz-1.2.8 libpcre-8.39 libpcap-1.8.1 nmap-libdnet-1.12 ipv6
Compiled without:
Available nsock engines: epoll poll select

So I am using namp version 7.60 on a Ubuntu Linux.

WARNING! nmap scan could get you into legal trouble if you don’t have permission to scan the target systems.

To scan an IP address, enter:
# nmap
$ sudo nmap
Sample outputs:

[sudo] password for vivek: 
Starting Nmap 7.60 ( ) at 2017-11-08 13:53 IST
Nmap scan report for gateway (
Host is up (0.23s latency).
Not shown: 994 closed ports
21/tcp   open  ftp
22/tcp   open  ssh
23/tcp   open  telnet
53/tcp   open  domain
80/tcp   open  http
5431/tcp open  park-agent
MAC Address: 10:62:EB:6A:DB:FD (D-Link International)
Nmap done: 1 IP address (1 host up) scanned in 4.65 seconds

To scan a range of IP addresses, enter:
# nmap
To scan an entire subnet:
# nmap
More examples:

## Ping only scan ##
nmap -sP
## Scan and do traceroute ##
nmap --traceroute IP-ADDRESS
nmap --traceroute DOMAIN-NAME-HERE
## TCP SYN Scan ##
nmap -sS
## UDP Scan ##
nmap -sU
## IP protocol scan ##
nmap -sO
## Scan port 80, 25, 443 ##
nmap -p 80
nmap -p http
nmap -p 25
nmap -p smtp
nmap -p 443
nmap -p 80,24,443
## Scan port ranges ##
nmap -p 512-1024
## Scan for OS i.e. Operating System Detection ##
nmap -O
nmap -O --osscan-guess
## Scan for application server version ##
nmap -sV

Type the following command to read nmap man page or see our 32 nmap command examples:
$ man nmap

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

0 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.