// Install lsof package (example for archlinux)
sudo pacman -S lsof
// List ports that are being used
sudo lsof -i -P -n | grep LISTEN
// lsof output example, the 2nd value is the process id (6951)
Discord 6951 damian 49u IPv4 47939 0t0 TCP 127.0.0.1:6463 (LISTEN)
// kill the process
kill 6951