This example shows how to detect and kill a process running on port 500 on Ubuntu machine.
1. Verify that port 500 is occupied on the machine:
netstat -an | grep 500
2. Show the ID of the process that uses port 500:
sudo fuser 500/udp
3. Kill the process:
sudo fuser -k 500/udp