Question

I'm getting a "socket.error: No socket could be created" when running a web.py script.

Is there a way to kill all processes on running on port 8080 (or any other port I wish) with a single line in Terminal on OSX Mavericks?

Was it helpful?

Solution

It's a single line, but you'd need to put it into a shell alias or shell script in order to make it easy to use:

$ kill $(lsof -i tcp:8080 | tail -n +2 | awk '{ print $2 }')

If you want to see and kill processes that don't belong to you, then sudo needs to get involved:

$ sudo kill $(sudo lsof -i tcp:8080 | tail -n +2 | awk '{ print $2 }')

OTHER TIPS

The best way to kill all proccesses running on port 8080 in ubuntu is:

sudo fuser -k 8080/tcp

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top