DEV Community

Cover image for Free your blocked ports on Linux
Pankaj
Pankaj

Posted on • Updated on • Originally published at slashism.com

Free your blocked ports on Linux

You closed all your code editors and terminals but your ports are still blocked.

The only solution you would have in your mind as a beginner is, to restart the computer. That would definitely fix this.

But what if there is a better way?

What if I can check where my port is being used and close that application, rather than restarting the computer?

For example, my blocked port is 3005 and I would like to see which application is still using it. I would simply run this in my terminal-

lsof -i :3005

This would give an output with a table of all the programs using this port 3005. Notice the PID column there and note down its value. In my case, it was 6595.

Now run the following command to kill the process and free the port from this evil app-

kill 6595

Now run your project on that port and live happily ever after.

Free Ports

Closing Notes

This is not a very frequent problem but can be frustrating for beginners and developers who are not proficient in Linux.

Top comments (0)