Sometimes we may find that a program is occupying a port, and we cannot use this port.
We can use two commands to solve this problem.

Find the program

1
2
netstat -anp | grep 4000
tcp6 0 0 :::4000 :::* LISTEN 81970/hexo

Here we can find the pid 81970 before the program name.

Kill the program

1
kill -9 81970

If the permissions are not enough, add sudo before the command.

Comments

⬆︎TOP