We can check if a port is in use or not, by following ways in Linux.
lsof
sudo lsof -i -P -n | grep LISTENAlso, we can check a specific port by running -
sudo lsof -i:{PORT_NUMBER}netstat
sudo netstat -tulpn | grep LISTENnmap
sudo nmap -sTU -O {IP_ADDRESS}Source: CyberCiti