Scanning for open ports

lsof

list of open files

lsof -i -P -n | grep LISTEN

netstat

Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships

netstat -tulpn | grep LISTEN

ss

utility to investigate sockets

ss -tulpn | grep LISTEN

nmap

network exploration tool, port scanner

nmap -open 192.168.3.34

scanning open ports on remote IP address

nc -zv 192.168.3.34 2>&1 1-1024 | grep -v refused

this scans open ports in the range of 1 to 1024 on the above IP address. redirects the error output to standard outoput and matches all lines except refused

scanning all open ports on the subnet using nmap

nmap -n 192.168.3.0/24

Sources