Check If A Port Is In Use
We can check if a port is in use or not, by following ways in Linux.
Option 1
lsof
$ sudo lsof -i -P -n | grep LISTEN
Also, we can check a specific port by running -
$ sudo lsof -i:{PORT_NUMBER}
Option 2
netstat
$ sudo netstat -tulpn | grep LISTEN
Option 3
nmap
$ sudo nmap -sTU -O {IP_ADDRESS}
Source: CyberCiti