Wednesday, February 01, 2023

How to check if ports are open and active on Ubuntu 20.04 server?

 To check if ports are open and active on an Ubuntu 20.04 server, you can use the nmap tool.


Here is an example of how to check if a specific port is open on a server:


nmap -p [port_number] [server_ip_or_hostname]


For example, to check if port 80 is open on the server with IP address 192.168.1.100:


nmap -p 80 192.168.1.100


You can also check for a range of ports by specifying the range of port numbers separated by a hyphen:


nmap -p [port_start]-[port_end] [server_ip_or_hostname]


For example, to check if ports 80 to 90 are open on the server with IP address 192.168.1.100:


nmap -p 80-90 192.168.1.100


The output will show the status of the port, including whether it is open, closed, or filtered.