Nmap is not usually installed by default, therefore we proceed to it.
Debian, Ubuntu, Linux Mint and derivatives:
sudo apt -y install nmap
Centos 7, Rhel 7 and derivatives:
sudo yum install nmap -y
The most used command is simply nmap hostname, this command will give you a list of all open ports and their services, for example:
csuarez @ WKR: ~ $ nmap wakalaquerico.com Starting Nmap 7.70 (https://nmap.org) at 2020-12-06 10:34 CST Nmap scan report for wakalaquerico.com (174.142.6.161) Host is up (0.15s latency). rDNS record for 174.142.6.161: adi- preschool.com Not shown: 958 filtered ports, 30 closed ports PORT STATE SERVICE 53 / tcp open domain 110 / tcp open pop3 143 / tcp open imap 443 / tcp open https 465 / tcp open smtps 993 / tcp open imaps 995 / tcp open pop3s Nmap done: 1 IP address (1 host up) scanned in 2.41 seconds
The following command will work for you to detect all active hosts on a network
nmap -sn 192.168.0.1/24
To scan a specific port you will only have to use the -p flag
nmap 192.168.0.1 -p22 (in this example port 22 is scanned)
If you need more information about a host you can use the -sV flags which will give you versions
csuarez @ WKR: ~ $ nmap -sV 8.8.8.8 Starting Nmap 7.70 (https://nmap.org) at 2020-12-06 10:51 CST Nmap scan report for dns.google (8.8.8.8) Host is up ( 0.13s latency). Not shown: 998 filtered ports PORT STATE SERVICE VERSION 53 / tcp open tcpwrapped 443 / tcp open ssl / https sffe Nmap done: 1 IP address (1 host up) scanned in 2.41 seconds
No Comment